diff options
author | mattab <matthieu.aubry@gmail.com> | 2016-10-03 00:29:55 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2016-10-03 00:29:55 +0300 |
commit | f771d57666c2150ff1d2f82cd9a80532a987f6f6 (patch) | |
tree | 9f57f6ce1ef175883b0a9335514523324e3f5cd1 /config | |
parent | b27cbb96da5a6fd1f7ef1ef90c5c09ca1b875613 (diff) |
If Piwik is not installed yet, it's possible the tmp/ folder is not writable, display a useful error message
If Piwik is not installed yet, it's possible the tmp/ folder is not writable
we prevent failing with an unclear message eg. coming from doctrine-cache
by forcing to use a cache backend which always works ie. array
Diffstat (limited to 'config')
-rw-r--r-- | config/global.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/config/global.php b/config/global.php index 36e04970aa..cd10f72370 100644 --- a/config/global.php +++ b/config/global.php @@ -45,10 +45,17 @@ return array( return $cache; }, 'Piwik\Cache\Backend' => function (ContainerInterface $c) { - try { - $backend = $c->get('ini.Cache.backend'); - } catch (NotFoundException $ex) { - $backend = 'chained'; // happens if global.ini.php is not available + // If Piwik is not installed yet, it's possible the tmp/ folder is not writable + // we prevent failing with an unclear message eg. coming from doctrine-cache + // by forcing to use a cache backend which always works ie. array + if(!\Piwik\SettingsPiwik::isPiwikInstalled()) { + $backend = 'array'; + } else { + try { + $backend = $c->get('ini.Cache.backend'); + } catch (NotFoundException $ex) { + $backend = 'chained'; // happens if global.ini.php is not available + } } return \Piwik\Cache::buildBackend($backend); |