From: danmarsden <danmarsden>
Date: Tue, 3 Mar 2009 01:18:16 +0000 (+0000)
Subject: MDL-14736 Backup/Restore don't halt backup if can't delete temp files - just display... 
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9d043b8c6b9b869df3138a63041c0dc5090e5f97;p=moodle.git

MDL-14736 Backup/Restore don't halt backup if can't delete temp files - just display notification and save error to log table
---

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 "<li>".get_string("deletingolddata").'</li>';
             }
-            $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