Merge branch 'MDL-29262' of git://github.com/stronk7/moodle

Conflicts:
	version.php
This commit is contained in:
Dan Poltawski 2012-04-23 12:42:16 +08:00
commit e0ed91ba39
8 changed files with 122 additions and 33 deletions

View file

@ -113,17 +113,18 @@ function cron_run() {
}
// Delete old backup_controllers and logs
if (!empty($CFG->loglifetime)) { // value in days
$loglifetime = $timenow - ($CFG->loglifetime * 3600 * 24);
// Delete child records from backup_logs
// Delete old backup_controllers and logs.
$loglifetime = get_config('backup', 'loglifetime');
if (!empty($loglifetime)) { // Value in days.
$loglifetime = $timenow - ($loglifetime * 3600 * 24);
// Delete child records from backup_logs.
$DB->execute("DELETE FROM {backup_logs}
WHERE EXISTS (
SELECT 'x'
FROM {backup_controllers} bc
WHERE bc.backupid = {backup_logs}.backupid
AND bc.timecreated < ?)", array($loglifetime));
// Delete records from backup_controllers
// Delete records from backup_controllers.
$DB->execute("DELETE FROM {backup_controllers}
WHERE timecreated < ?", array($loglifetime));
mtrace(" Deleted old backup records");