From 9d043b8c6b9b869df3138a63041c0dc5090e5f97 Mon Sep 17 00:00:00 2001 From: danmarsden Date: Tue, 3 Mar 2009 01:18:16 +0000 Subject: [PATCH] MDL-14736 Backup/Restore don't halt backup if can't delete temp files - just display notification and save error to log table --- backup/backup_scheduled.php | 6 +++++- backup/restorelib.php | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/backup/backup_scheduled.php b/backup/backup_scheduled.php index 28d6e451e1..c2abf718aa 100644 --- a/backup/backup_scheduled.php +++ b/backup/backup_scheduled.php @@ -58,7 +58,11 @@ function schedule_backup_cron() { //Delete old_entries from backup tables if ($status) { mtrace(" Deleting old data"); - $status = backup_delete_old_data(); + if (!backup_delete_old_data()) {; + $errorstr = "An error occurred deleting old backup data"; + add_to_backup_log(time(),$preferences->backup_course,$errorstr,'scheduledbackup'); + mtrace(" ".$errorstr); + } } //Now we get a list of courses in the server diff --git a/backup/restorelib.php b/backup/restorelib.php index 16706e31d0..1c391e11ac 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -7497,7 +7497,13 @@ define('RESTORE_GROUPS_GROUPINGS', 3); if (!defined('RESTORE_SILENTLY')) { echo "
  • ".get_string("deletingolddata").'
  • '; } - $status = backup_delete_old_data(); + if (!backup_delete_old_data()) {; + $errorstr = "An error occurred deleting old data"; + add_to_backup_log(time(),$preferences->backup_course,$errorstr,'restoreprecheck'); + if (!defined('RESTORE_SILENTLY')) { + notify($errorstr); + } + } } //Now copy he zip file to dataroot/temp/backup/backup_unique_code -- 2.39.5