예제 #1
0
        $existing_state['tempPath'] = ABSPATH . 'importbuddy/temp_' . pb_backupbuddy::random_string(12) . '/';
    } else {
        die('Error #843797944: Missing expected default state override.');
    }
}
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')) {
예제 #2
0
<?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.
예제 #3
0
<?php

// Incoming vars: $backupFile, $step
if (!current_user_can(pb_backupbuddy::$options['role_access'])) {
    die('Error #473623. Access Denied.');
}
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$rollback = new backupbuddy_restore('rollback');
$status = $rollback->start(backupbuddy_core::getBackupDirectory() . $backupFile);
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();
?>


<?php 
_e("This will roll back this site's database to the state contained within the selected backup file. Verify details below to make sure this is the correct database to roll back to. Current database tables will be a given a temporary prefix.  You will be given the opportunity to confirm changes before making them permanent. <b>Tip!</b> Create a Database or Full Backup before proceeding.", 'it-l10n-backupbuddy');
?>
<br><br>


<?php 
if (isset($restoreData['dat']['wordpress_version'])) {
    $wp_version = $restoreData['dat']['wordpress_version'];
} else {
    $wp_version = 'Unknown';
예제 #4
0
        }
        pb_backupbuddy::alert($message);
        pb_backupbuddy::status('error', $message);
        die;
    }
} else {
    if (isset(pb_backupbuddy::$options['default_state_overrides']) && count(pb_backupbuddy::$options['default_state_overrides']) > 0) {
        // Default state overrides exist. Apply them.
        $restoreData = pb_backupbuddy::$options['default_state_overrides'];
    } else {
        die('Error #843797944: Missing expected default state override.');
    }
}
// Instantiate restore class.
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$restore = new backupbuddy_restore('restore', $restoreData);
unset($restoreData);
// Access via $restore->_state to make sure it is always up to date.
if ('true' != pb_backupbuddy::_GET('deploy')) {
    // We dont accept submitted form options during deploy.
    $restore->_state = parse_options($restore->_state);
}
/*
echo '<pre>';
print_r( $restore->_state );
echo '</pre>';
*/
// Parse submitted options/settings.
function parse_options($restoreData)
{
    if ('1' == pb_backupbuddy::_POST('migrateDatabase')) {
예제 #5
0
    $restoreData['autoAdvance'] = false;
}
if ('1' == pb_backupbuddy::_POST('forceMysqlCompatibility')) {
    $restoreData['forceMysqlMethods'] = array('php');
}
$restoreData['restoreDatabase'] = true;
$restoreData['restoreFiles'] = false;
$restoreData['restoreFileRoot'] = $restoreData['tempPath'];
if ('2' == pb_backupbuddy::$options['zip_method_strategy']) {
    $restoreData['zipMethodStrategy'] = 'all';
} else {
    $restoreData['zipMethodStrategy'] = pb_backupbuddy::$options['zip_method_strategy'];
}
// Instantiate rollback.
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$rollback = new backupbuddy_restore('rollback', $restoreData);
$status = $rollback->restoreFiles();
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;
}
$status = $rollback->determineDatabaseFiles();
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;
예제 #6
0
<?php

// Incoming vars: $backupFile, $step
if (!current_user_can(pb_backupbuddy::$options['role_access'])) {
    die('Error #473623. Access Denied.');
}
//pb_backupbuddy::verify_nonce();
echo '<h3 style="margin-top: 0;">' . __('Rollback Complete', 'it-l10n-backupbuddy') . '</h3>';
$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->finalizeRollback();
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;
}
?>


<b>Thank you for choosing BackupBuddy!</b>


<script>
	pb_status_undourl( '' ); // Hide box.
</script>
예제 #7
0
pb_backupbuddy::flush();
// Parse submitted restoreData restore state from previous step.
$restoreData = pb_backupbuddy::_POST('restoreData');
if (NULL === ($restoreData = json_decode(urldecode(base64_decode($restoreData)), true))) {
    // All the encoding/decoding due to UTF8 getting mucked up along the way without all these layers. Blech!
    $message = 'ERROR #83893b: unable to decode JSON restore data `' . htmlentities($restoreData) . '`. Restore halted.';
    if (function_exists('json_last_error')) {
        $message .= ' json_last_error: `' . json_last_error() . '`.';
    }
    pb_backupbuddy::alert($message);
    pb_backupbuddy::status('error', $message);
    die;
}
// Instantiate restore class.
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$restore = new backupbuddy_restore('restore', $restoreData);
unset($restoreData);
// Access via $restore->_state to make sure it is always up to date.
$restore->_state = parse_options($restore->_state);
// Parse submitted options/settings.
function parse_options($restoreData)
{
    if ('1' == pb_backupbuddy::_POST('migrateDatabase')) {
        $restoreData['databaseSettings']['migrateDatabase'] = true;
    } else {
        $restoreData['databaseSettings']['migrateDatabase'] = false;
    }
    if ('1' == pb_backupbuddy::_POST('migrateDatabaseBruteForce')) {
        $restoreData['databaseSettings']['migrateDatabaseBruteForce'] = true;
    } else {
        $restoreData['databaseSettings']['migrateDatabaseBruteForce'] = false;
예제 #8
0
        }
        pb_backupbuddy::alert($message);
        pb_backupbuddy::status('error', $message);
        die;
    }
} else {
    if (isset(pb_backupbuddy::$options['default_state_overrides']) && count(pb_backupbuddy::$options['default_state_overrides']) > 0) {
        // Default state overrides exist. Apply them.
        $restoreData = pb_backupbuddy::$options['default_state_overrides'];
    } else {
        die('Error #4643225: Missing expected default state override.');
    }
}
// Instantiate restore class.
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$restore = new backupbuddy_restore('restore', $restoreData);
unset($restoreData);
// Access via $restore->_state to make sure it is always up to date.
if (false === $restore->_state['restoreDatabase']) {
    pb_backupbuddy::status('details', 'Database restore SKIPPED based on Step 1 settings.');
    echo "<script>bb_action( 'databaseRestoreSkipped' );</script>";
} else {
    // Connect ImportBuddy to the database with these settings.
    $restore->connectDatabase();
    // CAUTION: Wipe database tables with matching prefix if option was selected.
    if (TRUE === $restore->_state['databaseSettings']['wipePrefix']) {
        if (!isset($restore->_state['databaseSettings']['importResumeFiles']) && '' == $restore->_state['databaseSettings']['importResumePoint']) {
            // Only do this if not in process of resuming.
            pb_backupbuddy::status('message', 'Wiping existing database tables with the prefix `' . $restore->_state['databaseSettings']['prefix'] . '` based on settings...');
            if (TRUE !== pb_backupbuddy::$classes['import']->wipePrefix($restore->_state['databaseSettings']['prefix'], TRUE)) {
                pb_backupbuddy::status('error', 'Unable to wipe database tables matching prefix.');
예제 #9
0
// 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')));
// Set any advanced options into the current state.
if ('1' != pb_backupbuddy::_POST('autoAdvance')) {
    $restoreData['autoAdvance'] = false;
}
if ('1' == pb_backupbuddy::_POST('forceMysqlCompatibility')) {
    $restoreData['forceMysqlMethods'] = array('php');
}
// Instantiate rollback.
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$rollback = new backupbuddy_restore('rollback', $restoreData);
$status = $rollback->extractDatabase();
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();
?>


<script>
	pb_status_undourl( "<?php 
echo $restoreData['undoURL'];
예제 #10
0
파일: 5.php 프로젝트: khuonggau/pixel
        }
        pb_backupbuddy::alert($message);
        pb_backupbuddy::status('error', $message);
        die;
    }
} else {
    if (isset(pb_backupbuddy::$options['default_state_overrides']) && count(pb_backupbuddy::$options['default_state_overrides']) > 0) {
        // Default state overrides exist. Apply them.
        $restoreData = pb_backupbuddy::$options['default_state_overrides'];
    } else {
        die('Error #843797944: Missing expected default state override.');
    }
}
// Instantiate restore class.
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$restore = new backupbuddy_restore('restore', $restoreData);
unset($restoreData);
// Access via $restore->_state to make sure it is always up to date.
if ('true' != pb_backupbuddy::_GET('deploy')) {
    // We dont accept submitted form options during deploy.
    $restore->_state = parse_options($restore->_state);
}
/*
echo '<pre>';
print_r( $restore->_state );
echo '</pre>';
*/
// Parse submitted options/settings.
function parse_options($restoreData)
{
    if ('1' == pb_backupbuddy::_POST('migrateDatabase')) {
예제 #11
0
pb_backupbuddy::flush();
// Parse submitted restoreData restore state from previous step.
$restoreData = pb_backupbuddy::_POST('restoreData');
if (NULL === ($restoreData = json_decode(urldecode(base64_decode($restoreData)), true))) {
    // All the encoding/decoding due to UTF8 getting mucked up along the way without all these layers. Blech!
    $message = 'ERROR #83893a: unable to decode JSON restore data `' . htmlentities($restoreData) . '`. Restore halted.';
    if (function_exists('json_last_error')) {
        $message .= ' json_last_error: `' . json_last_error() . '`.';
    }
    pb_backupbuddy::alert($message);
    pb_backupbuddy::status('error', $message);
    die;
}
// Instantiate restore class.
require_once pb_backupbuddy::plugin_path() . '/classes/restore.php';
$restore = new backupbuddy_restore('restore', $restoreData);
unset($restoreData);
// Access via $restore->_state to make sure it is always up to date.
if (false === $restore->_state['restoreDatabase']) {
    pb_backupbuddy::status('details', 'Database restore SKIPPED based on Step 1 settings.');
    echo "<script>bb_action( 'databaseRestoreSkipped' );</script>";
} else {
    // Connect ImportBuddy to the database with these settings.
    $restore->connectDatabase();
    // CAUTION: Wipe database tables with matching prefix if option was selected.
    if (TRUE === $restore->_state['databaseSettings']['wipePrefix']) {
        if (!isset($restore->_state['databaseSettings']['importResumeFiles']) && '' == $restore->_state['databaseSettings']['importResumePoint']) {
            // Only do this if not in process of resuming.
            pb_backupbuddy::status('message', 'Wiping existing database tables with the prefix `' . $restore->_state['databaseSettings']['prefix'] . '` based on settings...');
            if (TRUE !== pb_backupbuddy::$classes['import']->wipePrefix($restore->_state['databaseSettings']['prefix'], TRUE)) {
                pb_backupbuddy::status('error', 'Unable to wipe database tables matching prefix.');