| 1 |
<?php |
| 2 |
add_action('wpdbbkp_backup_completed', array('WPDBFullBackupLog', 'wpdbbkp_backup_completed'), 11); |
| 3 |
|
| 4 |
class WPDBFullBackupLog { |
| 5 |
|
| 6 |
public static function wpdbbkp_backup_completed(&$args) { |
| 7 |
|
| 8 |
$options = get_option('wp_db_backup_backups'); |
| 9 |
$newoptions = array(); |
| 10 |
$count = 0; |
| 11 |
|
| 12 |
if(!empty($options) && is_array($options)){ |
| 13 |
|
| 14 |
foreach ($options as $option) { |
| 15 |
if ($option['filename'] == $args[0]) { |
| 16 |
$newoptions[] = $option; |
| 17 |
$newoptions['destination'] = wp_kses($args[4]); |
| 18 |
}else{ |
| 19 |
$newoptions[] = $option; |
| 20 |
} |
| 21 |
$count++; |
| 22 |
} |
| 23 |
|
| 24 |
} |
| 25 |
|
| 26 |
update_option('wp_db_backup_backups', $newoptions, false); |
| 27 |
|
| 28 |
if (get_option('wp_db_log') == 1) { |
| 29 |
if(isset($args[4]) && !empty($args[4])) |
| 30 |
{ |
| 31 |
if (is_writable($args[5]) || !file_exists($args[5])) { |
| 32 |
|
| 33 |
if (!$handle = @fopen($args[5], 'a')) |
| 34 |
return; |
| 35 |
|
| 36 |
if (!fwrite($handle, str_replace("<br>", "\n", $args[2]))) |
| 37 |
return; |
| 38 |
|
| 39 |
fclose($handle); |
| 40 |
|
| 41 |
return true; |
| 42 |
} |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
} |