From 2a43b21bae12f535dde95016d52282d0e182b2e4 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 4 Nov 2015 19:44:20 +0100 Subject: [PATCH] Enable PicoDeprecated if no plugins are loaded --- plugins/00-PicoDeprecated.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/plugins/00-PicoDeprecated.php b/plugins/00-PicoDeprecated.php index 496b9a71c..f1098a63f 100644 --- a/plugins/00-PicoDeprecated.php +++ b/plugins/00-PicoDeprecated.php @@ -69,14 +69,23 @@ class PicoDeprecated extends AbstractPicoPlugin */ public function onPluginsLoaded(&$plugins) { - foreach ($plugins as $plugin) { - if (!is_a($plugin, 'PicoPluginInterface')) { - // the plugin doesn't implement PicoPluginInterface; it uses deprecated events - // enable PicoDeprecated if it hasn't be explicitly enabled/disabled yet - if (!$this->isStatusChanged()) { - $this->setEnabled(true, true, true); + if (!empty($plugins)) { + foreach ($plugins as $plugin) { + if (!is_a($plugin, 'PicoPluginInterface')) { + // the plugin doesn't implement PicoPluginInterface; it uses deprecated events + // enable PicoDeprecated if it hasn't be explicitly enabled/disabled yet + if (!$this->isStatusChanged()) { + $this->setEnabled(true, true, true); + } + break; } - break; + } + } else { + // no plugins were found, so it actually isn't necessary to call deprecated events + // anyway, this plugin also ensures compatibility apart from events used by old plugins, + // so enable PicoDeprecated if it hasn't be explicitly enabled/disabled yet + if (!$this->isStatusChanged()) { + $this->setEnabled(true, true, true); } }