From c9f1b3a0c3c6fdbebd6f7e324d67fc229e8f8982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Tue, 18 Nov 2014 23:37:06 +0100 Subject: [PATCH 1/2] MDL-48210 plugin_manager: Invalidate caches after fetching updates info --- lib/classes/update/checker.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/classes/update/checker.php b/lib/classes/update/checker.php index b6ad40762a8..38e9d55a0d7 100644 --- a/lib/classes/update/checker.php +++ b/lib/classes/update/checker.php @@ -116,9 +116,14 @@ class checker { * @throws checker_exception */ public function fetch() { + $response = $this->get_response(); $this->validate_response($response); $this->store_response($response); + + // We need to reset plugin manager's caches - the currently existing + // singleton is not aware of eventually available updates we just fetched. + \core_plugin_manager::reset_caches(); } /** From 32c670c8c245a916ede7a8a485af9e332ffed129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Tue, 18 Nov 2014 23:43:21 +0100 Subject: [PATCH 2/2] MDL-48210 updates checker: Improve cron notifications processing These are cosmetic improvements spotted while working on the issue. 1. Do not waste time if there are no changes to notify about. 2. Fix the legacy plugin manager's get_plugins() call. --- lib/classes/update/checker.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/classes/update/checker.php b/lib/classes/update/checker.php index 38e9d55a0d7..3ec3f9886b6 100644 --- a/lib/classes/update/checker.php +++ b/lib/classes/update/checker.php @@ -634,9 +634,13 @@ class checker { protected function cron_notifications(array $changes) { global $CFG; + if (empty($changes)) { + return; + } + $notifications = array(); $pluginman = \core_plugin_manager::instance(); - $plugins = $pluginman->get_plugins(true); + $plugins = $pluginman->get_plugins(); foreach ($changes as $component => $componentchanges) { if (empty($componentchanges)) { @@ -696,6 +700,7 @@ class checker { global $CFG; if (empty($notifications)) { + $this->cron_mtrace('nothing to notify about. ', ''); return; }