From: stronk7 Date: Mon, 5 Jan 2004 00:27:22 +0000 (+0000) Subject: Now, when the status is RUNNING, the function checks how much X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=148b8edfca2eb70ddfe8a8f22423adeb493e1a2d;p=moodle.git Now, when the status is RUNNING, the function checks how much 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 !!! --- diff --git a/backup/backup_scheduled.php b/backup/backup_scheduled.php index 225dc37fe8..2c967a7a70 100644 --- a/backup/backup_scheduled.php +++ b/backup/backup_scheduled.php @@ -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