MDL-66279 task: Test if logger is_a database_logger MDL-66279-master
authorCameron Ball <cameron@moodle.com>
Tue, 30 Jul 2019 05:19:08 +0000 (13:19 +0800)
committerCameron Ball <cameron@moodle.com>
Tue, 30 Jul 2019 06:49:27 +0000 (14:49 +0800)
lib/classes/task/task_log_cleanup_task.php

index 188171a..5a6380f 100644 (file)
@@ -25,6 +25,9 @@ namespace core\task;
 
 defined('MOODLE_INTERNAL') || die();
 
+use core\task\database_logger;
+use core\task\logmanager;
+
 /**
  * A task to cleanup log entries for tasks.
  *
@@ -46,8 +49,9 @@ class task_log_cleanup_task extends scheduled_task {
      * Perform the cleanup task.
      */
     public function execute() {
-        if (\core\task\database_logger::class == \core\task\logmanager::get_logger_classname()) {
-            \core\task\database_logger::cleanup();
+        $logger = logmanager::get_logger_classname();
+        if (is_a($logger, database_logger::class, true)) {
+            $logger::cleanup();
         }
     }
 }