diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-10-08 07:49:55 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-10-08 07:49:55 +0400 |
commit | f5fc4eecc4b0147c5a15f0bc76d88af09c53c810 (patch) | |
tree | c8d576e14a798582e10d496ea394828be2bfb24c /plugins/CorePluginsAdmin/PluginInstaller.php | |
parent | a684fec0042067ad800491dfd130b25bfa354b8b (diff) |
refs #4123 Removing some warnings
Diffstat (limited to 'plugins/CorePluginsAdmin/PluginInstaller.php')
-rw-r--r-- | plugins/CorePluginsAdmin/PluginInstaller.php | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/CorePluginsAdmin/PluginInstaller.php b/plugins/CorePluginsAdmin/PluginInstaller.php index 849b910e21..3fabe7cf55 100644 --- a/plugins/CorePluginsAdmin/PluginInstaller.php +++ b/plugins/CorePluginsAdmin/PluginInstaller.php @@ -173,22 +173,23 @@ class PluginInstaller */ private function getNameOfFirstSubfolder($pluginDir) { - if ($dir = opendir($pluginDir)) { - $firstSubFolder = ''; - - while ($file = readdir($dir)) { - if ($file[0] != '.' && is_dir($pluginDir . DIRECTORY_SEPARATOR . $file)) { - $firstSubFolder = $file; - break; - } - } + if (!($dir = opendir($pluginDir))) { + return false; + } + $firstSubFolder = ''; - if (empty($firstSubFolder)) { - throw new PluginInstallerException('The plugin ZIP file does not contain a subfolder, but Piwik expects plugin files to be within a subfolder in the Zip archive.'); + while ($file = readdir($dir)) { + if ($file[0] != '.' && is_dir($pluginDir . DIRECTORY_SEPARATOR . $file)) { + $firstSubFolder = $file; + break; } + } - return $firstSubFolder; + if (empty($firstSubFolder)) { + throw new PluginInstallerException('The plugin ZIP file does not contain a subfolder, but Piwik expects plugin files to be within a subfolder in the Zip archive.'); } + + return $firstSubFolder; } private function fixPluginFolderIfNeeded($tmpPluginFolder) |