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
|
<?php // @author Dustin Bolton 2012.
// Set reference to destination. if ( isset( pb_backupbuddy::$options['remote_destinations'][pb_backupbuddy::_GET('destination_id')] ) ) { $destination = &pb_backupbuddy::$options['remote_destinations'][pb_backupbuddy::_GET('destination_id')]; }
// Welcome text. //pb_backupbuddy::$ui->title( 'Local Destination `' . $destination['title'] . '`' ); echo 'Listing backups in local directory `' . $destination['path'] . '`...<br><br>';
// Handle deletion. if ( pb_backupbuddy::_POST( 'bulk_action' ) == 'delete_backup' ) { pb_backupbuddy::verify_nonce(); $deleted_files = array(); foreach( (array)pb_backupbuddy::_POST( 'items' ) as $item ) { @unlink( $destination['path'] . $item ); if ( file_exists( $destination['path'] . $item ) ) { pb_backupbuddy::alert( 'Error: Unable to delete `' . $item . '`. Verify permissions.' ); } else { $deleted_files[] = $item; } } if ( count( $deleted_files ) > 0 ) { pb_backupbuddy::alert( 'Deleted ' . implode( ', ', $deleted_files ) . '.' ); } echo '<br>'; }
// Find backups in directory. $backups = glob( $destination['path'] . '*.zip' ); if ( !is_array( $backups ) ) { $backups = array(); }
// Generate array of table rows. $backup_list = array(); foreach( $backups as $backup ) { $backup_list[basename($backup)] = array( basename( $backup ), pb_backupbuddy::$format->date( pb_backupbuddy::$format->localize_time( filemtime( $backup ) ) ) . '<br /><span class="description">(' . pb_backupbuddy::$format->time_ago( filemtime( $backup ) ) . ' ago)</span>', pb_backupbuddy::$format->file_size( filesize( $backup ) ), ); }
$urlPrefix = pb_backupbuddy::ajax_url( 'remoteClient' ) . '&destination_id=' . htmlentities( pb_backupbuddy::_GET( 'destination_id' ) );
// Render table. pb_backupbuddy::$ui->list_table( $backup_list, array( 'action' => $urlPrefix, 'columns' => array( 'Backup File', 'Last Modified', 'File Size' ), //'hover_actions' => array( 'copy' => 'Copy to Local' ), 'hover_action_column_key' => '0', 'bulk_actions' => array( 'delete_backup' => 'Delete' ), 'css' => 'width: 100%;', ) );
|