. namespace core\task; /** * Scheduled task to clean up old stored_progress bar records. * * @package core * @copyright 2023 onwards Catalyst IT {@link http://www.catalyst-eu.net/} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Conn Warwicker */ class stored_progress_bar_cleanup_task extends scheduled_task { /** * Get a descriptive name for this task (shown to admins). * * @return string */ public function get_name() { return get_string('storedprogressbarcleanuptask', 'admin'); } /** * Delete all the old stored progress bar records. * By default this runs once per day at 1AM. * * @return void */ public function execute(): void { global $DB; $twentyfourhoursago = time() - DAYSECS; $DB->delete_records_select('stored_progress', 'lastupdate < :ago', ['ago' => $twentyfourhoursago]); mtrace('Deleted old stored_progress records'); } }