diff options
author | Stefan Giehl <stefan@matomo.org> | 2022-04-06 03:21:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 03:21:25 +0300 |
commit | eb27d163a82d667c36c3c071991daf97c62c4ac0 (patch) | |
tree | cc198cf0e5b70c9129a2e12b8d10d1e756979223 | |
parent | 71c8e06663809356342c24b532e7aed15e92e5c2 (diff) |
Fix twig cache config (#19050)
* Revert "Update global.php (#19048)"
This reverts commit 9d6d7a98516943c280c35a3f5f014d371734c5d0.
* Fix twig cache path
* apply PSR12 code formatting
-rw-r--r-- | config/global.php | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/config/global.php b/config/global.php index c40c8fb773..f6fbe51e0c 100644 --- a/config/global.php +++ b/config/global.php @@ -4,7 +4,7 @@ use Psr\Container\ContainerInterface; use Matomo\Cache\Eager; use Piwik\SettingsServer; -return array( +return [ 'path.root' => PIWIK_DOCUMENT_ROOT, @@ -35,7 +35,7 @@ return array( 'view.clearcompiledtemplates.enable' => true, - 'twig.cache' => DI\string('{path.tmp}/templates'), + 'twig.cache' => DI\string('{path.tmp.templates}'), 'Matomo\Cache\Eager' => function (ContainerInterface $c) { $backend = $c->get('Matomo\Cache\Backend'); @@ -60,7 +60,7 @@ return array( // 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::isMatomoInstalled()) { + if (!\Piwik\SettingsPiwik::isMatomoInstalled()) { $backend = 'array'; } else { try { @@ -73,10 +73,10 @@ return array( return \Piwik\Cache::buildBackend($backend); }, 'cache.eager.cache_id' => function () { - return 'eagercache-' . str_replace(array('.', '-'), '', \Piwik\Version::VERSION) . '-'; + return 'eagercache-' . str_replace(['.', '-'], '', \Piwik\Version::VERSION) . '-'; }, - 'entities.idNames' => DI\add(array('idGoal', 'idDimension')), + 'entities.idNames' => DI\add(['idGoal', 'idDimension']), 'Psr\Log\LoggerInterface' => DI\create('Psr\Log\NullLogger'), @@ -85,19 +85,20 @@ return array( 'DeviceDetector\Cache\Cache' => DI\autowire('Piwik\DeviceDetector\DeviceDetectorCache')->constructor(86400), - 'observers.global' => array(), + 'observers.global' => [], /** - * By setting this option to false, the check that the DB schema version matches the version of the source code will be no longer performed. - * Thus it allows you to execute for example a newer version of Matomo with an older Matomo database version. Please note - * disabling this setting is not recommended because often an older DB version is not compatible with newer source code. - * If you disable this setting, make sure to execute the updates after updating the source code. The setting can be useful if - * you want to update Matomo without any outage when you know the current source code update will still run fine for a short time - * while in the background the database updates are running. + * By setting this option to false, the check that the DB schema version matches the version of the source code will + * be no longer performed. Thus it allows you to execute for example a newer version of Matomo with an older Matomo + * database version. Please note disabling this setting is not recommended because often an older DB version is not + * compatible with newer source code. + * If you disable this setting, make sure to execute the updates after updating the source code. The setting can be + * useful if you want to update Matomo without any outage when you know the current source code update will still + * run fine for a short time while in the background the database updates are running. */ 'EnableDbVersionCheck' => true, - 'fileintegrity.ignore' => DI\add(array( + 'fileintegrity.ignore' => DI\add([ '*.htaccess', '*web.config', 'bootstrap.php', @@ -148,7 +149,7 @@ return array( '*.gitattributes', '*.bower.json', '*.travis.yml', - )), + ]), 'Piwik\EventDispatcher' => DI\autowire()->constructorParameter('observers', DI\get('observers.global')), @@ -157,7 +158,7 @@ return array( $config = $c->get('Piwik\Config'); $general = $config->General; - $ips = array(); + $ips = []; if (!empty($general['login_allowlist_ip']) && is_array($general['login_allowlist_ip'])) { $ips = $general['login_allowlist_ip']; } elseif (!empty($general['login_whitelist_ip']) && is_array($general['login_whitelist_ip'])) { @@ -165,7 +166,7 @@ return array( $ips = $general['login_whitelist_ip']; } - $ipsResolved = array(); + $ipsResolved = []; foreach ($ips as $ip) { $ip = trim($ip); @@ -188,8 +189,10 @@ return array( if (function_exists('dns_get_record')) { $entry = @dns_get_record($ip, DNS_AAAA); - if (!empty($entry['0']['ipv6']) - && filter_var($entry['0']['ipv6'], FILTER_VALIDATE_IP)) { + if ( + !empty($entry['0']['ipv6']) + && filter_var($entry['0']['ipv6'], FILTER_VALIDATE_IP) + ) { $resolvedIps[] = $entry['0']['ipv6']; } } @@ -218,15 +221,19 @@ return array( ->constructorParameter('lookbackNSecondsCustom', DI\get('ini.Tracker.window_look_back_for_visitor')), 'Piwik\Tracker\Settings' => DI\autowire() - ->constructorParameter('isSameFingerprintsAcrossWebsites', DI\get('ini.Tracker.enable_fingerprinting_across_websites')), + ->constructorParameter( + 'isSameFingerprintsAcrossWebsites', + DI\get('ini.Tracker.enable_fingerprinting_across_websites') + ), 'archiving.performance.logger' => null, - \Piwik\CronArchive\Performance\Logger::class => DI\autowire()->constructorParameter('logger', DI\get('archiving.performance.logger')), + \Piwik\CronArchive\Performance\Logger::class => DI\autowire() + ->constructorParameter('logger', DI\get('archiving.performance.logger')), \Piwik\Concurrency\LockBackend::class => \DI\get(\Piwik\Concurrency\LockBackend\MySqlLockBackend::class), - \Piwik\Segment\SegmentsList::class => function(){ + \Piwik\Segment\SegmentsList::class => function () { return \Piwik\Segment\SegmentsList::get(); } -); +]; |