Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2013-09-19 02:07:38 +0400
committerThomas Steur <thomas.steur@gmail.com>2013-09-19 02:07:38 +0400
commitea2ae320e98a04ba94ae91cd5efd80abfdb12d96 (patch)
tree48cce6edddd8f12f252de263ec5bd81935c441f0 /plugins/CorePluginsAdmin/PluginInstaller.php
parent7761b37afdbfa096be6f360877057541ab44da6d (diff)
display errors during installing plugin, improved display of themes
Diffstat (limited to 'plugins/CorePluginsAdmin/PluginInstaller.php')
-rw-r--r--plugins/CorePluginsAdmin/PluginInstaller.php26
1 files changed, 18 insertions, 8 deletions
diff --git a/plugins/CorePluginsAdmin/PluginInstaller.php b/plugins/CorePluginsAdmin/PluginInstaller.php
index 192264feca..e77b79757d 100644
--- a/plugins/CorePluginsAdmin/PluginInstaller.php
+++ b/plugins/CorePluginsAdmin/PluginInstaller.php
@@ -53,11 +53,21 @@ class PluginInstaller
{
$this->removeFileIfExists($pluginZipTargetFile);
- $marketplace = new MarketplaceApiClient();
- $success = $marketplace->download($this->pluginName, $pluginZipTargetFile);
+ try {
+ $marketplace = new MarketplaceApiClient();
+ $pluginDetails = $marketplace->getPluginInfo($this->pluginName);
+ } catch (\Exception $e) {
+ throw new PluginInstallerException($e->getMessage());
+ }
+
+ if (empty($pluginDetails)) {
+ throw new PluginInstallerException('A plugin with this name does not exist');
+ }
- if (!$success) {
- throw new \Exception('Failed to download plugin');
+ try {
+ $marketplace->download($this->pluginName, $pluginZipTargetFile);
+ } catch (\Exception $e) {
+ throw new PluginInstallerException('Failed to download plugin: ' . $e->getMessage());
}
}
@@ -73,18 +83,18 @@ class PluginInstaller
$this->removeFolderIfExists($pathExtracted);
if (0 == ($pluginFiles = $archive->extract($pathExtracted))) {
- throw new \Exception(Piwik_TranslateException('Plugin_ExceptionArchiveIncompatible', $archive->errorInfo()));
+ throw new PluginInstallerException(Piwik_TranslateException('Plugin_ExceptionArchiveIncompatible', $archive->errorInfo()));
}
if (0 == count($pluginFiles)) {
- throw new \Exception(Piwik_TranslateException('Plugin Zip File Is Empty'));
+ throw new PluginInstallerException(Piwik_TranslateException('Plugin Zip File Is Empty'));
}
}
private function makeSurePluginJsonExists($tmpPluginFolder)
{
- if (!file_exists($tmpPluginFolder . '/' . $this->pluginName . '/plugin.json')) {
- throw new \Exception('It is not a valid Plugin, missing plugin.json');
+ if (!file_exists($tmpPluginFolder . DIRECTORY_SEPARATOR . $this->pluginName . DIRECTORY_SEPARATOR . 'plugin.json')) {
+ throw new PluginInstallerException('Plugin is not valid, missing plugin.json');
}
}