<?php

// Incoming vars: $backupFile, $step
if (!current_user_can(pb_backupbuddy::$options['role_access'])) {
    die('Error #473623. Access Denied.');
}
//pb_backupbuddy::verify_nonce();
$restoreData = unserialize(base64_decode(pb_backupbuddy::_POST('restoreData')));
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$rollback = new backupbuddy_restore('rollback', $restoreData);
$status = $rollback->swapDatabases();
if (false === $status) {
    $errors = $rollback->getErrors();
    if (count($errors) > 0) {
        pb_backupbuddy::alert('Errors were encountered: ' . implode(', ', $errors) . ' If seeking support please click to Show Advanced Details above and provide a copy of the log.');
    }
    return;
}
$restoreData = $rollback->getState();
?>


<h3>Test your site then select <i>Accept</i> to lock in changes or <i>Cancel</i> to undo.</h3>
<a href="<?php 
echo site_url();
?>
" target="_new"><b>Click here to test your site</b></a> before proceeding.
<br><br>
If your site functions as expected you may proceed to making these changes permanent by selecting the button below to
accept the changes. If anything appears wrong or you have not made a backup of your original site you should select to cancel
the rollback to revert your site to its prior condition.
Esempio n. 2
0
    }
}
if (!file_exists($archiveFile)) {
    die('Error #834984: Specified backup archive `' . htmlentities($archiveFile) . '` not found. Did you delete it? If the file exists, try again or verify proper read file permissions for PHP to access the file.');
}
if ('1' == pb_backupbuddy::_POST('skipUnzip')) {
    $skipUnzip = true;
} else {
    $skipUnzip = false;
}
// Instantiate restore class.
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$restore = new backupbuddy_restore('restore', $existing_state);
$status = $restore->start($archiveFile, $skipUnzip);
if (false === $status) {
    $errors = $restore->getErrors();
    if (count($errors) > 0) {
        $errorMsg = 'Errors were encountered: ' . implode(', ', $errors) . ' If seeking support please click to Show Advanced Details above and provide a copy of the log.';
        pb_backupbuddy::status('error', $errorMsg);
    } else {
        $errorMsg = 'Error #894383: Unknown error starting restore. See advanced status log for details.';
    }
    pb_backupbuddy::alert($errorMsg);
    return;
}
$restore->_state['defaultURL'] = $restore->getDefaultUrl();
$restore->_state['defaultDomain'] = $restore->getDefaultDomain();
if ('true' != pb_backupbuddy::_GET('deploy')) {
    // deployment mode pre-loads state data in a file instead of passing via post.
    $restore->_state = parse_options($restore->_state);
}