1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<?php // Incoming vars: $backupFile, $step if ( ! current_user_can( pb_backupbuddy::$options['role_access'] ) ) { die( 'Error #473623. Access Denied.' ); } //pb_backupbuddy::verify_nonce();
$nextStep = 3;
$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->restoreDatabase(); 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; } elseif ( is_numeric( $status ) ) { // Incomplete, has more to import at a certain point. $nextStep = 2; // more to do on step 2. } elseif ( is_array( $status ) ) { // Finished an entire SQL file, pick back up on next SQL file defined in the state. $nextStep = 2; // more to do on step 2. } elseif ( true === $status ) { // Completely finished everything! // yay. } else { $error = 'Error #9483493: Unknown mysqlbuddy response `' . $status . '`.'; pb_backupbuddy::status( 'error', $error ); }
$restoreData = $rollback->getState(); ?>
<?php if ( true === $restoreData['autoAdvance'] ) { // Auto-advance if enabled. ?> <?php _e( 'Continuing to next step... You should be redirected momentarily.', 'it-l10n-backupbuddy' ); ?> <br><br> <script> jQuery(document).ready(function() { jQuery( '#pb_backupbuddy_rollback_form' ).submit(); }); </script> <?php } ?>
<form id="pb_backupbuddy_rollback_form" method="post" action="?action=pb_backupbuddy_backupbuddy&function=rollback&step=<?php echo $nextStep; ?>&archive=<?php echo basename( $restoreData['archive'] ); ?>"> <?php pb_backupbuddy::nonce(); ?> <input type="hidden" name="restoreData" value="<?php echo base64_encode( serialize( $restoreData ) ); ?>"> <input type="submit" name="submitForm" class="button button-primary" value="<?php echo __('Next Step') . ' »'; ?>"> </form>
|