diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2013-09-19 02:28:29 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2013-09-19 02:28:29 +0400 |
commit | b3eabc90e12e8b91113b77005e442f7bc5eee06d (patch) | |
tree | 6fffb245e6854795f326375dc29b41900ce5159d | |
parent | e667cf5f6d964a42d1076ace14cf7d36b0bcf25c (diff) |
perform redirect to extend, otherwise page reload will not work afterwards. check whether plugin exists before activating, does not work so far because loadPlugin loads a plugin even in case it does not exist
-rw-r--r-- | plugins/CorePluginsAdmin/Controller.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php index 53a62c2bf3..41ccd1c33d 100644 --- a/plugins/CorePluginsAdmin/Controller.php +++ b/plugins/CorePluginsAdmin/Controller.php @@ -46,10 +46,16 @@ class Controller extends \Piwik\Controller\Admin } Nonce::discardNonce('CorePluginsAdmin.activatePlugin'); + + $plugin = PluginsManager::getInstance()->loadPlugin($pluginName); + + if (empty($plugin)) { + throw new \Exception('Failed to activate, the plugin is not installed'); + } + PluginsManager::getInstance()->activatePlugin($pluginName); - // TODO perform redirect otherwise page reload won't work afterwards - $this->extend(); + $this->redirectToIndex('CorePluginsAdmin', 'extend'); } public function updatePlugin() |