From 50dcc8af9c3977e6081b3dc5e042cc9b04b406d0 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 2 Mar 2017 09:15:10 +0800 Subject: [PATCH] MDL-53978 core: Do not run callbacks if upgrade is running --- lib/moodlelib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 304eeec7aee..b939f2a0445 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -7474,6 +7474,11 @@ function get_plugin_list_with_function($plugintype, $function, $file = 'lib.php' function get_plugins_with_function($function, $file = 'lib.php', $include = true) { global $CFG; + if (during_initial_install() || isset($CFG->upgraderunning)) { + // API functions _must not_ be called during an installation or upgrade. + return []; + } + $cache = \cache::make('core', 'plugin_functions'); // Including both although I doubt that we will find two functions definitions with the same name. -- 2.11.4.GIT