I noticed we deleted the config cache in
IniFileChain when we
dumpChanges() but the actual cache file is not yet overwritten. This actually happens in the config class. We need to make sure to delete the config cache only after we have written the config file. Otherwise there could be race conditions where the outdated config gets cached again, and if the user made two changes within one hour (that's how long the cache is active), then a previous change would be potentially undone.
I was going to use the
Core.configFileChanged event to listen to config file changes, however, at the time I would listen to the event using
Piwik::addAction('Core.configFileChanged', ...) the DI container might not exist yet etc. Therefore I figured it's best to invalidate the cache specifically by calling the delete method within the config to ensure it'll work and not cause any trouble to something so critical.