diff --git a/classes/task/delete_local_empty_directories.php b/classes/task/delete_local_empty_directories.php index 74cb69c4..96d1399a 100644 --- a/classes/task/delete_local_empty_directories.php +++ b/classes/task/delete_local_empty_directories.php @@ -27,11 +27,10 @@ use coding_exception; use tool_objectfs\local\manager; +use core\cron; defined('MOODLE_INTERNAL') || die(); -require_once($CFG->libdir.'/cronlib.php'); - class delete_local_empty_directories extends task { /** @var string $stringname */ @@ -51,7 +50,7 @@ public function execute() { return; } $filesystem = new $this->config->filesystem(); - cron_trace_time_and_memory(); + cron::trace_time_and_memory(); $filesystem->delete_empty_dirs(); } } diff --git a/lib.php b/lib.php index 59159ebe..5106bcc3 100644 --- a/lib.php +++ b/lib.php @@ -69,22 +69,6 @@ define('TOOL_OBJECTFS_DELETE_EXTERNAL_TRASH', 1); define('TOOL_OBJECTFS_DELETE_EXTERNAL_FULL', 2); -// Legacy cron function. -function tool_objectfs_cron() { - mtrace('RUNNING legacy cron objectfs'); - global $CFG; - if ($CFG->branch <= 26) { - // Unlike the task system, we do not get fine grained control over - // when tasks/manipulators run. Every cron we just run all the manipulators. - (new manipulator_builder())->execute_all(); - - \tool_objectfs\local\report\objectfs_report::cleanup_reports(); - \tool_objectfs\local\report\objectfs_report::generate_status_report(); - } - - return true; -} - /** * Sends a plugin file to the browser. * @param $course diff --git a/tests/local/tasks_test.php b/tests/local/tasks_test.php index 6cae7841..8a71d024 100644 --- a/tests/local/tasks_test.php +++ b/tests/local/tasks_test.php @@ -32,13 +32,6 @@ protected function tearDown(): void { ob_end_clean(); } - public function test_run_legacy_cron() { - $config = manager::get_objectfs_config(); - $config->enabletasks = true; - manager::set_objectfs_config($config); - $this->assertTrue(tool_objectfs_cron()); - } - public function test_run_scheduled_tasks() { global $CFG; // If tasks not implemented.