diff options
-rw-r--r-- | config/global.php | 2 | ||||
-rw-r--r-- | core/FrontController.php | 2 | ||||
-rw-r--r-- | core/View.php | 9 | ||||
-rw-r--r-- | plugins/Diagnostics/Diagnostic/WriteAccessCheck.php | 4 |
4 files changed, 13 insertions, 4 deletions
diff --git a/config/global.php b/config/global.php index ac77d53179..f7834df256 100644 --- a/config/global.php +++ b/config/global.php @@ -33,6 +33,8 @@ return array( 'path.cache' => DI\string('{path.tmp}/cache/tracker/'), + 'view.clearcompiledtemplates.enable' => true, + 'Matomo\Cache\Eager' => function (ContainerInterface $c) { $backend = $c->get('Matomo\Cache\Backend'); $cacheId = $c->get('cache.eager.cache_id'); diff --git a/core/FrontController.php b/core/FrontController.php index f7c09659ca..448abb5b75 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -305,7 +305,7 @@ class FrontController extends Singleton $tmpPath . '/cache/', $tmpPath . '/logs/', $tmpPath . '/tcpdf/', - $tmpPath . '/templates_c/', + StaticContainer::get('path.tmp.templates'), ); Filechecks::dieIfDirectoriesNotWritable($directoriesToCheck); diff --git a/core/View.php b/core/View.php index c5c3b14899..624537bc5c 100644 --- a/core/View.php +++ b/core/View.php @@ -446,8 +446,13 @@ class View implements ViewInterface */ public static function clearCompiledTemplates() { - $templatesCompiledPath = StaticContainer::get('path.tmp') . '/templates_c'; - Filesystem::unlinkRecursive($templatesCompiledPath, false); + $enable = StaticContainer::get('view.clearcompiledtemplates.enable'); + if ($enable) { + // some high performance systems that run many Matomo instances may never want to clear this template cache + // if they use eg a blue/green deployment + $templatesCompiledPath = StaticContainer::get('path.tmp.templates'); + Filesystem::unlinkRecursive($templatesCompiledPath, false); + } } /** diff --git a/plugins/Diagnostics/Diagnostic/WriteAccessCheck.php b/plugins/Diagnostics/Diagnostic/WriteAccessCheck.php index be4971f4f0..caa76231d8 100644 --- a/plugins/Diagnostics/Diagnostic/WriteAccessCheck.php +++ b/plugins/Diagnostics/Diagnostic/WriteAccessCheck.php @@ -7,6 +7,7 @@ */ namespace Piwik\Plugins\Diagnostics\Diagnostic; +use Piwik\Container\StaticContainer; use Piwik\DbHelper; use Piwik\Filechecks; use Piwik\Translation\Translator; @@ -86,7 +87,8 @@ class WriteAccessCheck implements Diagnostic $this->tmpPath . '/logs/', $this->tmpPath . '/sessions/', $this->tmpPath . '/tcpdf/', - $this->tmpPath . '/templates_c/', + StaticContainer::get('path.tmp.templates') + , ); if (! DbHelper::isInstalled()) { |