New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy downloaded plugin to all plugins directories #14537
Conversation
config/global.ini.php
Outdated
@@ -705,6 +705,9 @@ | |||
; breaks and reencrypts SSL connections you can set your custom file here. | |||
custom_cacert_pem= | |||
|
|||
; set to 1 to copy downloaded plugins to all plugins directories including those defined in MATOMO_PLUGIN_DIRS env variable | |||
copy_to_plugins_dirs = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nabiltntn AFAIK MATOMO_PLUGIN_DIRS
is either defined as an environment variable or GLOBALS (through bootstrap.php). Should we have the same for this directory that it can be only configured as a GLOBAL and/or ENV variable? Because the feature should only work if the copy to plugin directory
is also defined as a plugin directory
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the implementation to use a new env var : MATOMO_PLUGIN_COPY_DIR
if (!empty(Config::getInstance()->General['copy_to_plugins_dirs'])) { | ||
$pluginsDirs = Manager::getPluginsDirectories(); | ||
// Copy plugin to all plugins directories | ||
foreach ($pluginsDirs as $dir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this copies it into all plugin directories, I reckon matomo may have trouble with this if there are multiple directories defined. It should copy the plugin only into one plugin directory. We have uses cases where we define multiple plugin directories (one directory for each plugin in fact)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i changed to copy only to directory defined in MATOMO_PLUGIN_COPY_DIR
if it's within getPluginsDirectories
array
|
||
$pluginsDirs = [Manager::getPluginsDirectory()]; | ||
|
||
if (!empty($GLOBALS['MATOMO_PLUGIN_COPY_DIR'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case someone configures $GLOBALS['MATOMO_PLUGIN_COPY_DIR']
directly, do we maybe also need to check that directory is actually one of the configured plugin directories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i made a change in initPluginDirectories
to check $GLOBALS['MATOMO_PLUGIN_COPY_DIR']
in both cases ( via env var or directly )
cheers @nabiltntn |
When downloading a plugins from Marketplace UI, it would be useful to copy them also to folders defined in MATOMO_PLUGINS_DIRS . This is useful when Matomo is deployed in env with Persistent Volume like Kubernetes
The PR copies plugin to all directories and not to one of them because in practice
MATOMO_PLUGINS_DIRS
will have only one directory outside Matomo directory.fixes #14534