Merge branch 'MDL-68631' of https://github.com/jonof/moodle
[moodle.git] / lib / cronlib.php
index 917e5b5..bea9252 100644 (file)
@@ -275,6 +275,8 @@ function cron_run_inner_scheduled_task(\core\task\task_base $task) {
         }
         \core\task\manager::scheduled_task_failed($task);
     } finally {
+        // Reset back to the standard admin user.
+        cron_setup_user();
         cron_prepare_core_renderer(true);
     }
     get_mailer('close');