diff --git a/application/libraries/PluginManager/PluginBase.php b/application/libraries/PluginManager/PluginBase.php index 83474eb8bf8..6f05eec1662 100644 --- a/application/libraries/PluginManager/PluginBase.php +++ b/application/libraries/PluginManager/PluginBase.php @@ -400,8 +400,16 @@ public function readConfigFile() { // Do everything related to reading config fields // TODO: Create a config object for this? One object for each config field? Then loop through those fields. - $this->checkActive(); - $this->saveNewVersion(); + $pluginModel = \Plugin::model()->findByPk($this->id); + + // "Impossible" + if (empty($pluginModel)) + { + throw new \Exception('Internal error: Found no database entry for plugin id ' . $this->id); + } + + $this->checkActive($pluginModel); + $this->saveNewVersion($pluginModel); } } else @@ -415,16 +423,8 @@ public function readConfigFile() * This is the 'active-by-default' feature. * @return void */ - protected function checkActive() + protected function checkActive($pluginModel) { - $pluginModel = \Plugin::model()->findByPk($this->id); - - // "Impossible" - if (empty($pluginModel)) - { - throw new \Exception('Internal error: Found no database entry for plugin id ' . $this->id); - } - if ($this->config->active == 1) { // Activate plugin