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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
|
<?php if ( ! defined( 'PB_IMPORTBUDDY' ) || ( true !== PB_IMPORTBUDDY ) ) { die( '<html></html>' ); } ?> <script> jQuery( '#pageTitle' ).html( 'Step 1: Select Backup to Restore' ); function backupRestoreSuggest( backupType ) { if ( 'db' == backupType ) { // DB has no files (except SQL of course) so skip root file extraction. jQuery( 'input[name="restoreFiles"]' ).prop( 'checked', false ).attr( 'disabled', true ); jQuery( 'input[name="restoreDatabase"]' ).prop( 'checked', true ).attr( 'disabled', false ); } else if ( 'files' == backupType ) { // Files has no DB so disable DB. jQuery( 'input[name="restoreFiles"]' ).prop( 'checked', true ).attr( 'disabled', false ); jQuery( 'input[name="restoreDatabase"]' ).prop( 'checked', false ).attr( 'disabled', true ); } else { // default restore all jQuery( 'input[name="restoreFiles"]' ).prop( 'checked', true ).attr( 'disabled', false ); jQuery( 'input[name="restoreDatabase"]' ).prop( 'checked', true ).attr( 'disabled', false ); } } jQuery(document).ready(function() { jQuery( '.selectableBackupArchive' ).click( function(){ backupType = jQuery(this).attr( 'data-type' ); backupRestoreSuggest( backupType ); }); startingBackupType = jQuery( '.selectableBackupArchive:checked' ).attr( 'data-type' ); backupRestoreSuggest( startingBackupType ); }); </script>
<?php echo '<div class="step-wrap step-selectBackup-wrap">';
// Display pre-flight scan warnings & errors. $preflightResults = preflightScan(); if ( count( $preflightResults ) > 0 ) { pb_backupbuddy::alert( implode( '<hr>', $preflightResults ) ); } unset( $preflightResults );
//$step = '1'; //echo '<script>pageTitle( "Step <span class=\"step_number\">' . $step . '</span> of 6: Choose your backup file" );</script>';
if ( 'stash' == pb_backupbuddy::_GET( 'upload' ) ) { require( '_html_1_stash.php' ); echo '</div>'; return; } ?>
<div class="wrap">
<?php if ( pb_backupbuddy::_GET( 'file' ) != '' ) { $backup_archives = array( pb_backupbuddy::_GET( 'file' ) ); echo '<div style="padding: 15px; background: #FFFFFF;">Restoring from backup <i>' . htmlentities( pb_backupbuddy::_GET( 'file' ) ) . '</i></div> <form action="?ajax=2" method="post" target="restorebuddy_iframe">'; echo '<input type="hidden" name="file" value="' . pb_backupbuddy::_GET( 'file' ) . '">'; } else { ?> <div class="backup_select_buttons"> <button href="#pb_upload_modal" class="button button-secondary leanModal createdb_modal_link" style="font-size: 14px;">Upload a Backup</button> <button href="#pb_stash_modal" class="button button-secondary leanModal createdb_modal_link" style="font-size: 14px;">Restore from Stash</button> </div> <?php $backup_archives = get_archives_list(); if ( 0 == count( $backup_archives ) ) { // No backups found. // Look for manually unzipped pb_backupbuddy::alert( '<b>No BackupBuddy Zip backup found in this directory `' . ABSPATH . '`</b> - You must upload a backup file by FTP (into the same directory as this importbuddy.php file), the upload tab, or import from Stash via the Stash tab above to continue. <b>Do not rename the backup file from its original filename.</b> If you manually extracted/unzipped, upload the backup file, select it, then select <i>Advanced Troubleshooting Options</i> & click <i>Skip Zip Extraction</i>. Refresh this page once you have uploaded the backup.' ); } else { // Found one or more backups. ?> <form action="?ajax=2" method="post" target="miniFrame"> <input type="hidden" name="pass_hash" value="<?php echo PB_PASSWORD; ?>"> <input type="hidden" name="options" value="<?php echo htmlspecialchars( serialize( pb_backupbuddy::$options ) ); ?>'" /> <?php echo '<div class="backup_select_text">Backups in <span>' . ABSPATH . '</span></div>'; echo '<ul class="round-wrap">'; $backup_count = count( $backup_archives ); $i = 0; foreach( $backup_archives as $backup_id => $backup_archive ) { $i++; $backup_type = ''; $backup_type_text = ''; if ( $backup_archive['comment']['type'] == '' ) { if ( stristr( $backup_archive['file'], '-db-' ) !== false ) { $backup_type_text = 'Database Only Backup'; $backup_type = 'db'; } elseif ( stristr( $backup_archive['file'], '-full-' ) !== false ) { $backup_type_text = 'Full Backup'; $backup_type = 'full'; } elseif ( stristr( $backup_archive['file'], '-files-' ) !== false ) { $backup_type_text = 'Files Only Backup'; $backup_type = 'files'; } elseif ( stristr( $backup_archive['file'], '-export-' ) !== false ) { $backup_type_text = 'Multisite Subsite Export'; $backup_type = 'export'; } } else { if ( $backup_archive['comment']['type'] == 'db' ) { $backup_type_text = 'Database Only Backup'; $backup_type = 'db'; } elseif ( $backup_archive['comment']['type'] == 'full' ) { $backup_type_text = 'Full Backup'; $backup_type = 'full'; } elseif ( $backup_archive['comment']['type'] == 'files' ) { $backup_type_text = 'Files Only Backup'; $backup_type = 'files'; } elseif ( $backup_archive['comment']['type'] == 'export' ) { $backup_type_text = 'Multisite Subsite Export'; $backup_type = 'export'; } else { $backup_type_text = $backup_archive['comment']['type'] . ' Backup'; $backup_type = $backup_archive['comment']['type']; } } echo '<li>'; echo '<input class="selectableBackupArchive" type="radio" '; if ( $backup_id == 0 ) { echo 'checked="checked" '; } echo 'name="file" value="' . $backup_archive['file'] . '" data-type="' . $backup_type . '"> ' . $backup_archive['file']; echo '<span style="float: right;">' . pb_backupbuddy::$format->file_size( filesize( ABSPATH . $backup_archive['file'] ) ) . '</span>'; echo '<div class="description" style="margin-left: 22px; margin-top: 6px; font-style: normal; line-height: 26px;">'; $meta = array(); echo $backup_type_text; if ( $backup_archive['comment']['created'] != '' ) { echo ' from ' . pb_backupbuddy::$format->date( $backup_archive['comment']['created'] ); } if ( $backup_archive['comment']['wp_version'] != '' ) { echo ' on WordPress v' . $backup_archive['comment']['wp_version']; } /* if ( $backup_archive['comment']['bb_version'] != '' ) { echo ' & BackupBuddy v' . $backup_archive['comment']['bb_version']; } */ if ( $backup_archive['comment']['siteurl'] != '' ) { echo '<br>Site: ' . $backup_archive['comment']['siteurl']; } if ( $backup_archive['comment']['profile'] != '' ) { echo '<br>Profile: ' . htmlentities( $backup_archive['comment']['profile'] ); } if ( $backup_archive['comment']['note'] != '' ) { echo '<br>Note: ' . htmlentities( $backup_archive['comment']['note'] ) . '<br>'; } // Show meta button if meta info available. if ( $backup_archive['comment']['type'] != '' ) { $file_hash = md5( $backup_archive['file'] ); echo '<a href="#hash_view" class="button button-tertiary leanModal view_hash_click" style=" float: right;" id="view_hash_' . $i . '" data-file="' . $backup_archive['file'] . '">View Checksum</a>'; echo '<a href="#info_' . $file_hash . '" class="button button-tertiary leanModal" style="float: right;" id="view_meta_' . $i . '">View Meta</a>'; ?> <div id="hash_view" style="display: none; height: 30%;"> <div class="modal"> <div class="modal_header"> <a class="modal_close">×</a> <h2>View Checksum</h2> </div> <div class="modal_content"> <span id="hash_view_loading"><img src="importbuddy/images/loading.gif"> Calculating backup file Checksum (MD5 hash)... This may take a moment...</span> <span id="hash_view_response"></span> </div> </div> </div> <div id="<?php echo 'info_' . $file_hash; ?>" style="display: none; height: 90%;"> <div class="modal"> <div class="modal_header"> <a class="modal_close">×</a> <h2>Backup Meta Information</h2> </div> <div class="modal_content"> <?php $comment_meta = array(); foreach( $backup_archive['comment'] as $comment_line_name => $comment_line_value ) { // Loop through all meta fields in the comment array to display. if ( false !== ( $response = backupbuddy_core::pretty_meta_info( $comment_line_name, $comment_line_value ) ) ) { $comment_meta[] = $response; } } if ( count( $comment_meta ) > 0 ) { pb_backupbuddy::$ui->list_table( $comment_meta, array( 'columns' => array( 'Meta Information', 'Value' ), 'css' => 'width: 100%; min-width: 200px;', ) ); } else { echo '<i>No meta data found in zip comment. Skipping meta information display.</i>'; } ?> </div> </div> </div> <?php } // end if type not blank. //echo implode( ' - ', $meta ); echo '</div>'; echo '</li>'; } echo '</ul>'; } ?> <?php } // End file not given in querystring.
// If one or more backup files was found then provide a button to continue. if ( ( !empty( $backup_archives ) ) || ( 'stash' == pb_backupbuddy::_POST( 'upload' ) ) ) { echo '</div><!-- /wrap -->'; ?> <div class="main_box_foot"> <center> <div style="margin-top: 20px; margin-bottom: 30px;"> <b>What would you like to restore from the backup?</b> <label style="float: inherit;"> <input type="checkbox" name="restoreFiles" value="1" CHECKED> Files </label> <label style="float: inherit;"> <input type="checkbox" name="restoreDatabase" value="1" CHECKED> Database </label> </div> <input type="submit" name="submit" value="Restore Backup" class="it-button"> <button id="advanced_options_button" href="#pb_advanced_modal" class="it-button it-secondary leanModal">Advanced Options</button> </center> </div> <?php } else { //pb_backupbuddy::alert( 'Upload a backup file to continue.' ); echo '<br /><br /><br />'; echo '<b>You must upload a backup file by FTP, the upload tab, or import from Stash to continue.</b>'; echo '</div><!-- /wrap -->'; } ?>
<div id="pb_advanced_modal" style="display: none;"> <div class="modal"> <div class="modal_header"> <a class="modal_close">×</a> <h2>Advanced Options</h2> Exercise caution. Additional options available on subsequent steps. </div> <div class="modal_content"> Unzip Strategy: <select name="zipMethodStrategy"> <option value="all" SELECTED>All Available ( unzip via exec() > ZipArchive > PclZip ) - default</option> <option value="ziparchive">Compatibility: ZipArchive</option> <option value="pclzip">Compatibility: PclZip</option> </select> <br><br> <input type="checkbox" name="migrateHtaccess" value="1" CHECKED> Migrate .htaccess file URLs & paths (if URL changes).<br> <input type="checkbox" name="skipUnzip" value="1"> Skip unzipping or opening archive (for manual extraction). <br><br>
</div> </div> </div>
<?php echo '</form>'; ?>
</div><!-- end wrapper div -->
<div id="pb_upload_modal" style="display: none;"> <div class="modal"> <div class="modal_header"> <a class="modal_close">×</a> <h2>Upload Backup</h2> Smaller backups can be uploaded here directly from your computer. Larger backups work best over FTP or other methods. </div> <div class="modal_content"> <form enctype="multipart/form-data" action="" method="POST"> <input type="hidden" name="pass_hash" value="<?php echo PB_PASSWORD; ?>"> <input type="hidden" name="upload" value="local"> <input type="hidden" name="options" value="<?php echo htmlspecialchars( serialize( pb_backupbuddy::$options ) ); ?>'"> Choose a local backup to upload:<br> <p> <input name="file" type="file" style="width: 100%;"> </p> <br> <input type="submit" value="Upload Backup" class="toggle button"> </form> </div> </div> </div>
<div id="pb_stash_modal" style="display: none;"> <div class="modal"> <div class="modal_header"> <a class="modal_close">×</a> <h2>Restore Backup from Stash</h2> Backups stored in your iThemes Stash may be retrieved for restoring here. </div> <div class="modal_content"> <?php require( '_html_1_stash.php' ); ?> </div> </div> </div>
|