Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Dev: Don't open plugin overview if there's no config file
  • Loading branch information
olleharstedt committed Mar 23, 2018
1 parent f36b01c commit 6cd675b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion application/controllers/admin/PluginManagerController.php
Expand Up @@ -185,7 +185,10 @@ public function configure($id)
$plugin = Plugin::model()->findByPk($id);
$oPluginObject = App()->getPluginManager()->loadPlugin($plugin->name, $plugin->id);

$oPluginObject->readConfigFile();
if (!$oPluginObject->readConfigFile()) {
Yii::app()->user->setFlash('error', gT('Found no configuration file for this plugin.'));
$this->getController()->redirect($url);
}

if ($plugin === null) {
Yii::app()->user->setFlash('error', gT('The plugin was not found.'));
Expand Down
5 changes: 4 additions & 1 deletion application/libraries/PluginManager/PluginBase.php
Expand Up @@ -392,7 +392,7 @@ public function log($message, $level = \CLogger::LEVEL_TRACE)
* Read XML config file and store it in $this->config
* Assumes config file is config.xml and in plugin root folder.
* @todo Could this be moved to plugin model?
* @return void
* @return boolean
*/
public function readConfigFile()
{
Expand All @@ -405,6 +405,7 @@ public function readConfigFile()
if ($this->config === null) {
// Failed. Popup error message.
$this->showConfigErrorNotification();
return false;
} else if ($this->configIsNewVersion()) {
// 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.
Expand All @@ -418,8 +419,10 @@ public function readConfigFile()
$this->checkActive($pluginModel);
$this->saveNewVersion($pluginModel);
}
return true;
} else {
$this->log('Found no config file');
return false;
}
}

Expand Down

0 comments on commit 6cd675b

Please sign in to comment.