Merge branch 'master-MDL-71044_v3' of https://github.com/golenkovm/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2021-03-16 22:38:48 +01:00
6 changed files with 191 additions and 29 deletions
+9 -1
View File
@@ -23,6 +23,10 @@
*/
namespace core\task;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
/**
* Simple task to delete old backup records.
*/
@@ -47,7 +51,8 @@ class backup_cleanup_task extends scheduled_task {
$loglifetime = get_config('backup', 'loglifetime');
if (empty($loglifetime)) {
throw new coding_exception('The \'loglifetime\' config is not set. Can\'t proceed and delete old backup records.');
mtrace('The \'loglifetime\' config is not set. Can\'t proceed and delete old backup records.');
return;
}
// First, get the list of all backupids older than loglifetime.
@@ -65,6 +70,9 @@ class backup_cleanup_task extends scheduled_task {
$DB->delete_records('backup_controllers', array('backupid' => $record->backupid));
}
}
// Delete files and dirs older than 1 week.
\backup_helper::delete_old_backup_dirs(strtotime('-1 week'));
}
}