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:
authornabiltntn <zouabi.nabil@live.com>2019-07-05 16:53:07 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2019-07-05 16:53:07 +0300
commit64d27fa6e0350d3475e1f8608053453cb08ef110 (patch)
tree34754448f87561f722dec27c96332853f5343ea7
parent1d0cc7295b61f318030caee8e8268253807b3268 (diff)
Copy downloaded plugin to all plugins directories (#14537)
* Copy download plugin to all plugins directories including MATOMO_PLUGIN_DIRS * Use MATOMO_PLUGIN_COPY_DIR env and Global * Remove unused import * Copy plugin only to one directory * Check $GLOBALS['MATOMO_PLUGIN_COPY_DIR'] in both cases
-rw-r--r--core/Plugin/Manager.php11
-rw-r--r--plugins/CorePluginsAdmin/PluginInstaller.php4
2 files changed, 15 insertions, 0 deletions
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php
index 834bfdb3d2..a455666cc4 100644
--- a/core/Plugin/Manager.php
+++ b/core/Plugin/Manager.php
@@ -381,6 +381,17 @@ class Manager
});
}
}
+
+ $envCopyDir = getenv('MATOMO_PLUGIN_COPY_DIR');
+ if (!empty($envCopyDir)) {
+ $GLOBALS['MATOMO_PLUGIN_COPY_DIR'] = $envCopyDir;
+ }
+
+ if (!empty($GLOBALS['MATOMO_PLUGIN_COPY_DIR'])
+ && !in_array($GLOBALS['MATOMO_PLUGIN_COPY_DIR'], self::getPluginsDirectories())
+ ) {
+ throw new \Exception('"MATOMO_PLUGIN_COPY_DIR" dir must be one of "MATOMO_PLUGIN_DIRS" directories');
+ }
}
public static function getAlternativeWebRootDirectories()
diff --git a/plugins/CorePluginsAdmin/PluginInstaller.php b/plugins/CorePluginsAdmin/PluginInstaller.php
index 78bccb88c4..8404165bb6 100644
--- a/plugins/CorePluginsAdmin/PluginInstaller.php
+++ b/plugins/CorePluginsAdmin/PluginInstaller.php
@@ -298,6 +298,10 @@ class PluginInstaller
private function copyPluginToDestination($tmpPluginFolder)
{
$pluginsDir = Manager::getPluginsDirectory();
+
+ if (!empty($GLOBALS['MATOMO_PLUGIN_COPY_DIR'])) {
+ $pluginsDir = $GLOBALS['MATOMO_PLUGIN_COPY_DIR'];
+ }
$pluginTargetPath = $pluginsDir . $this->pluginName;
$this->removeFolderIfExists($pluginTargetPath);