]> git.mjollnir.org Git - moodle.git/commitdiff
Now, when the status is RUNNING, the function checks how much
authorstronk7 <stronk7>
Mon, 5 Jan 2004 00:27:22 +0000 (00:27 +0000)
committerstronk7 <stronk7>
Mon, 5 Jan 2004 00:27:22 +0000 (00:27 +0000)
old is that status in backup_logs table. If there is no activity
in that period, then the script status is unlocked automatically.
This prevents to become RUNNING for ever !!!

backup/backup_scheduled.php

index 225dc37fe8b2aa4cd10bfdeb2402378729752d02..2c967a7a7030b64ebba951f7c486d84295098e00 100644 (file)
@@ -23,7 +23,18 @@ function schedule_backup_cron() {
         return true;
     } else if (isset($backup_config->backup_sche_running) && $backup_config->backup_sche_running) {
         echo "...RUNNING\n";
-        return true;
+        //Now check if it's a really running task or something very old looking 
+        //for info in backup_logs to unlock status as necessary
+        $timetosee = 1800;   //Half an hour looking for activity
+        $timeafter = time() - $timetosee;
+        $numofrec = count_records_select ("backup_log","time > $timeafter");
+        if (!$numofrec) {
+            $timetoseemin = $timetosee/60;
+            echo "    No activity in last ".$timetoseemin." minutes. Unlocking status\n";
+        } else {
+            echo "    Scheduled backup seems to be running. Execution delayed\n";
+            return true;
+        }
     } else {
         echo "...OK\n";
         //Mark backup_sche_running