/**
  * restore
  *
  * @param $options array(
  *      'backupDir'  => string // location of backup to restore
  *      'config'     => bool   // restore config
  *      'db'         => bool   // restore database
  *      'files'      => bool   // restore files
  *    )
  *
  * @param $options
  * @throws Exception
  */
 public function restore($options)
 {
     if (!isset($options['backupDir'])) {
         throw new Exception("you need to specify the backupDir");
     }
     if ($options['config']) {
         $configBackupFile = $options['backupDir'] . '/tine20_config.tar.bz2';
         if (!file_exists($configBackupFile)) {
             throw new Exception("{$configBackupFile} not found");
         }
         $configDir = isset($options['configDir']) ? $options['configDir'] : false;
         if (!$configDir) {
             $configFile = stream_resolve_include_path('config.inc.php');
             if (!$configFile) {
                 throw new Exception("can't detect configDir, please use configDir option");
             }
             $configDir = dirname($configFile);
         }
         `cd {$configDir}; tar xf {$configBackupFile}`;
     }
     Setup_Core::setupConfig();
     $config = Setup_Core::getConfig();
     if ($options['db']) {
         $this->_backend->restore($options['backupDir']);
     }
     $filesDir = isset($config->filesdir) ? $config->filesdir : false;
     if ($options['files']) {
         $filesBackupFile = $options['backupDir'] . '/tine20_files.tar.bz2';
         if (!file_exists($filesBackupFile)) {
             throw new Exception("{$filesBackupFile} not found");
         }
         `cd {$filesDir}; tar xf {$filesBackupFile}`;
     }
 }