Skip to content

Commit

Permalink
merged wp-cron-db-backup into wp-db-backup
Browse files Browse the repository at this point in the history
  • Loading branch information
skippy committed Jul 12, 2005
1 parent c974ebc commit ac8f84c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions wp-db-backup.php
Expand Up @@ -13,6 +13,7 @@
*/

add_action('admin_menu', 'add_wp_backup_menu');
add_action('wp_cron_daily', 'wp_cron_db_backup');
global $wp_backup_dir, $wp_backup_error;
$wp_backup_error = '';
$wp_backup_dir = 'wp-content/backup/';
Expand Down Expand Up @@ -453,4 +454,34 @@ function wp_backup_menu() {

}// end wp_backup_menu()

/////////////////////////////
function wp_cron_db_backup() {

$schedule = intval(get_option('wp_cron_backup_schedule'));
if (0 == $schedule) {
// Scheduled backup is disabled
return;
}

global $wp_backup_dir, $wp_backup_error, $table_prefix;
$core_tables = array ($table_prefix . categories,
$table_prefix . comments,
$table_prefix . linkcategories,
$table_prefix . links,
$table_prefix . options,
$table_prefix . post2cat,
$table_prefix . postmeta,
$table_prefix . posts,
$table_prefix . users);

$recipient = get_option('wp_cron_backup_recipient');

$backup_file = wp_db_backup(TRUE, $core_tables);
if (FALSE !== $backup_file) {
wp_deliver_backup ($backup_file, 'smtp', $recipient);
}

return;
} // wp_cron_db_backup

?>

0 comments on commit ac8f84c

Please sign in to comment.