Exemple #1
0
    show_opts();
    exit;
} else {
    // Actually do a restore
    if (!$items) {
        backup_log(_('Nothing to restore!'));
        exit;
    }
    backup_log(_('Initializing Restore...'));
    if (!file_exists($vars['restore'])) {
        backup_log(_('Backup file not found! Aborting.'));
        return false;
    }
    //TODO: should we use the manifest to ensure that all
    //files exists before trying to restore them?
    $manifest = backup_get_manifest_tarball($vars['restore']);
    //run hooks
    if (isset($manifest['hooks']['pre_restore']) && $manifest['hooks']['pre_restore']) {
        backup_log(_('Running pre-restore scripts...'));
        exec($manifest['hooks']['pre_restore']);
    }
    backup_log(_('Running pre-restore hooks, if any...'));
    mod_func_iterator('backup_pre_restore_hook', $manifest);
    // Are we restoring the web root? We need to detect that,
    // so that (via #8059) if we aren't, don't restore the mysql
    // database, as the existing one will still be correct.
    $restoringwebroot = false;
    if (isset($items['files']) && $items['files']) {
        if ($items['files'] === true) {
            backup_log(_('Restoring all files (this may take some time)...'));
            $filelist = recurse_dirs(".", $manifest['file_list']);
Exemple #2
0
     array_walk_recursive($var['servers'], 'callback');
     array_walk_recursive($var['templates'], 'callback');
     if (is_array($_SESSION['backup_restore_path'])) {
         //TODO: if $var['restore_path'] is an array, that means it contains an error + error
         // message. Do something with the error meesage
         echo _('Invalid backup for or undefined error');
         break;
     }
     //try to get a manifest, and continue if we did
     if ($var['manifest'] = backup_get_manifest_tarball($_SESSION['backup_restore_path'])) {
         $content = load_view(dirname(__FILE__) . '/views/restore/backup_list.php', $var);
         break;
     }
     //we didnt get a manifest. Maybe this is a legacy backup?
     $var['restore_path'] = backup_migrate_legacy($_SESSION['backup_restore_path']);
     $var['manifest'] = backup_get_manifest_tarball($var['restore_path']);
     if ($var['restore_path'] && $var['manifest']) {
         $_SESSION['backup_restore_path'] = $var['restore_path'];
         echo load_view(dirname(__FILE__) . '/views/restore/backup_list.php', $var);
         break;
     }
     //still here? oops, something is really broken
     $message = _('Invalid backup for or undefined error');
     dbug($_SESSION['backup_restore_path'], $var);
     break;
 case 'restore_post':
     while (ob_get_level()) {
         ob_end_clean();
     }
     $_SESSION['backup_restore_data'] = $var['restore'];
     exit;
Exemple #3
0
         //read out the first 10 lines of the file
         //use the 'old fashtion' way of reading a file, as it
         //guarenties that we dont load more than 1 line at a time
         $file = fopen($b->b['_tmpfile'], 'r');
         $linecount = 0;
         backup_log(_('File verification failed. '));
         backup_log(_('Here are the first few lines of the file ' . 'as sent by the remote server:'));
         backup_log('');
         while (($line = fgets($file)) !== false && $linecount < 10) {
             backup_log(' > ' . $line);
             $linecount++;
         }
         exit(1);
     }
     backup_log(_('Processing received file...'));
     $b->b['manifest'] = backup_get_manifest_tarball($b->b['_tmpfile']);
     $b->save_manifest('db');
 }
 backup_log(_('Storing backup...'));
 $b->store_backup();
 backup_log(_('Running post-backup hooks...'));
 $b->run_hooks('post-backup');
 if ($b->b['bu_server'] == "0") {
     //local backup? Were done!
     if ($b->b['error'] !== false) {
         backup_log(_('Backup completed with errors!'));
     } else {
         backup_log(_('Backup successfully completed!'));
     }
 } else {
     if (isset($b->b['restore']) && ($b->b['restore'] == "on" || $b->b['restore'] == "true")) {