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 <tsteur@users.noreply.github.com>2019-09-21 04:02:42 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2019-09-21 04:02:42 +0300
commitf3dc40b93b9e67ec51b0d829966b7f2e82e1e953 (patch)
treee8c025a1da4a3e33f34fbb903593607195d5740f /core/Config.php
parentb00220e9c401a1a0da3a57422cd7c8b41fdb1691 (diff)
No config reload on save (#14824)
Found an interesting issue today re config... when the config is saved, we reload the config afterwards in https://github.com/matomo-org/matomo/blob/3.12.0-b2/core/Config.php#L447 The problem is, that any `plugins/*/config/config.php` or `config/config.php` that is changing the config using DI is then ignored when reloading the config. Looks like something like this: ``` 'Piwik\Config' => DI\decorate(function ($previous) { $general = $previous->General; $general['force_ssl'] = 1; $previous->General = $general; return $previous; }), ``` We're using this quite intensively in various places. I wonder in that case how to best re-initialise the config to make sure DI is executed again. Like removing it from DI, and then initialising it again using DI... would that work somehow? Problem is that maybe there could be still outdated references to the old config instance... I wonder maybe by default we should not reload the config simply? Not sure why we do it. It was likely not really an issue before since it would have simply saved all changes in `Config` to the local config and then reloaded it again. However, in a new plugin I will have an event to not save some config parameters to the config file. I will have an event `postEvent('Config.beforeSave', array(&$config))` where I then do something like `unset($config['General']['force_ssl'])` to avoid saving some values in the config. Eg to not save DB credentials in the config etc.
Diffstat (limited to 'core/Config.php')
-rw-r--r--core/Config.php13
1 files changed, 1 insertions, 12 deletions
diff --git a/core/Config.php b/core/Config.php
index 5d4467a9fa..f434a51fdd 100644
--- a/core/Config.php
+++ b/core/Config.php
@@ -409,16 +409,9 @@ class Config
/**
* Write user configuration file
*
- * @param array $configLocal
- * @param array $configGlobal
- * @param array $configCommon
- * @param array $configCache
- * @param string $pathLocal
- * @param bool $clear
- *
* @throws \Exception if config file not writable
*/
- protected function writeConfig($clear = true)
+ protected function writeConfig()
{
$output = $this->dumpConfig();
if ($output !== null
@@ -446,10 +439,6 @@ class Config
*/
Piwik::postEvent('Core.configFileChanged', [$localPath]);
}
-
- if ($clear) {
- $this->reload();
- }
}
/**