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:
authordiosmosis <diosmosis@users.noreply.github.com>2019-03-07 05:24:03 +0300
committerGitHub <noreply@github.com>2019-03-07 05:24:03 +0300
commite2b9414bf29c12bab57dc7c9630243738e90b458 (patch)
treebca6e3df5e745cfc0107dab61f1c318cdad51d83 /plugins/Marketplace/Controller.php
parent0d5d0dfe40f771d437fa0bf36e8393daa3da07d3 (diff)
Allow updating multiple plugins at once. (#14052)
* Allow updating multiple plugins at once. * Disable checkbox if plugin is not downloadable. * Fix translation typo. * really fix typo
Diffstat (limited to 'plugins/Marketplace/Controller.php')
-rw-r--r--plugins/Marketplace/Controller.php47
1 files changed, 27 insertions, 20 deletions
diff --git a/plugins/Marketplace/Controller.php b/plugins/Marketplace/Controller.php
index 407eb86aa8..ca39fc1958 100644
--- a/plugins/Marketplace/Controller.php
+++ b/plugins/Marketplace/Controller.php
@@ -393,32 +393,36 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
$this->dieIfPluginsAdminIsDisabled();
$this->displayWarningIfConfigFileNotWritable();
- $pluginName = $this->getPluginNameIfNonceValid($nonceName);
+ $plugins = $this->getPluginNameIfNonceValid($nonceName);
$view = new View('@Marketplace/' . $template);
$this->setBasicVariablesView($view);
$view->errorMessage = '';
- $view->plugin = array('name' => $pluginName);
- try {
- $this->pluginInstaller->installOrUpdatePluginFromMarketplace($pluginName);
+ $pluginInfos = [];
+ foreach ($plugins as $pluginName) {
+ $pluginInfos[] = $this->plugins->getPluginInfo($pluginName);
- } catch (\Exception $e) {
+ try {
+ $this->pluginInstaller->installOrUpdatePluginFromMarketplace($pluginName);
- $notification = new Notification($e->getMessage());
- $notification->context = Notification::CONTEXT_ERROR;
- $notification->type = Notification::TYPE_PERSISTENT;
- $notification->flags = Notification::FLAG_CLEAR;
- if (method_exists($e, 'isHtmlMessage') && $e->isHtmlMessage()) {
- $notification->raw = true;
- }
- Notification\Manager::notify('CorePluginsAdmin_InstallPlugin', $notification);
+ } catch (\Exception $e) {
- Url::redirectToReferrer();
- return;
+ $notification = new Notification($e->getMessage());
+ $notification->context = Notification::CONTEXT_ERROR;
+ $notification->type = Notification::TYPE_PERSISTENT;
+ $notification->flags = Notification::FLAG_CLEAR;
+ if (method_exists($e, 'isHtmlMessage') && $e->isHtmlMessage()) {
+ $notification->raw = true;
+ }
+ Notification\Manager::notify('CorePluginsAdmin_InstallPlugin', $notification);
+
+ Url::redirectToReferrer();
+ return;
+ }
}
- $view->plugin = $this->plugins->getPluginInfo($pluginName);
+ $view->plugins = $pluginInfos;
return $view;
}
@@ -435,11 +439,14 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
$pluginName = Common::getRequestVar('pluginName', null, 'string');
- if (!$this->pluginManager->isValidPluginName($pluginName)) {
- throw new Exception('Invalid plugin name');
+ $plugins = explode(',', $pluginName);
+ $plugins = array_map('trim', $plugins);
+ foreach ($plugins as $name) {
+ if (!$this->pluginManager->isValidPluginName($name)) {
+ throw new Exception('Invalid plugin name: ' . $name);
+ }
}
-
- return $pluginName;
+ return $plugins;
}
private function dieIfPluginsAdminIsDisabled()