diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2013-09-13 06:06:50 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2013-09-13 06:09:32 +0400 |
commit | ba4f5f207bcc088062e31fbf03d6447afe0dc6cf (patch) | |
tree | 74d7c48825f4a293ee1f9868eac597a35ad29c13 | |
parent | a752dec91b0e236c0ecf10f3f3d67e69cdc5a08e (diff) |
make sure plugin json exists in plugin
-rw-r--r-- | plugins/CorePluginsAdmin/PluginInstaller.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/CorePluginsAdmin/PluginInstaller.php b/plugins/CorePluginsAdmin/PluginInstaller.php index c6c54b89c1..0fa791c795 100644 --- a/plugins/CorePluginsAdmin/PluginInstaller.php +++ b/plugins/CorePluginsAdmin/PluginInstaller.php @@ -37,6 +37,7 @@ class PluginInstaller $this->makeSureFoldersAreWritable(); $this->downloadPluginFromMarketplace($tmpPluginZip); $this->extractPluginFiles($tmpPluginZip, $tmpPluginFolder); + $this->makeSurePluginJsonExists($tmpPluginFolder); $this->copyPluginToDestination($tmpPluginFolder); $this->removeFileIfExists($tmpPluginZip); @@ -80,6 +81,13 @@ class PluginInstaller } } + private function makeSurePluginJsonExists($tmpPluginFolder) + { + if (!file_exists($tmpPluginFolder . 'plugin.json')) { + throw new \Exception('It is not a valid Plugin, missing plugin.json'); + } + } + private function copyPluginToDestination($tmpPluginFolder) { $pluginTargetPath = PIWIK_USER_PATH . self::PATH_TO_EXTRACT . $this->pluginName; |