PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 4.3.0
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v4.3.0
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / config / global.php
matomo / app / config Last commit date
environment 5 years ago global.ini.php 5 years ago global.php 5 years ago
global.php
196 lines
1 <?php
2
3 use Psr\Container\ContainerInterface;
4 use Matomo\Cache\Eager;
5 use Piwik\SettingsServer;
6
7 return array(
8
9 'path.root' => PIWIK_DOCUMENT_ROOT,
10
11 'path.misc.user' => 'misc/user/',
12
13 'path.tmp' => function (ContainerInterface $c) {
14 $root = PIWIK_USER_PATH;
15
16 // TODO remove that special case and instead have plugins override 'path.tmp' to add the instance id
17 if ($c->has('ini.General.instance_id')) {
18 $instanceId = $c->get('ini.General.instance_id');
19 $instanceId = $instanceId ? '/' . $instanceId : '';
20 } else {
21 $instanceId = '';
22 }
23
24 /** @var Piwik\Config\ $config */
25 $config = $c->get('Piwik\Config');
26 $general = $config->General;
27 $tmp = empty($general['tmp_path']) ? '/tmp' : $general['tmp_path'];
28
29 return $root . $tmp . $instanceId;
30 },
31
32 'path.cache' => DI\string('{path.tmp}/cache/tracker/'),
33
34 'Matomo\Cache\Eager' => function (ContainerInterface $c) {
35 $backend = $c->get('Matomo\Cache\Backend');
36 $cacheId = $c->get('cache.eager.cache_id');
37
38 if (SettingsServer::isTrackerApiRequest()) {
39 $eventToPersist = 'Tracker.end';
40 $cacheId .= 'tracker';
41 } else {
42 $eventToPersist = 'Request.dispatch.end';
43 $cacheId .= 'ui';
44 }
45
46 $cache = new Eager($backend, $cacheId);
47 \Piwik\Piwik::addAction($eventToPersist, function () use ($cache) {
48 $cache->persistCacheIfNeeded(43200);
49 });
50
51 return $cache;
52 },
53 'Matomo\Cache\Backend' => function (ContainerInterface $c) {
54 // If Piwik is not installed yet, it's possible the tmp/ folder is not writable
55 // we prevent failing with an unclear message eg. coming from doctrine-cache
56 // by forcing to use a cache backend which always works ie. array
57 if(!\Piwik\SettingsPiwik::isMatomoInstalled()) {
58 $backend = 'array';
59 } else {
60 try {
61 $backend = $c->get('ini.Cache.backend');
62 } catch (\DI\NotFoundException $ex) {
63 $backend = 'chained'; // happens if global.ini.php is not available
64 }
65 }
66
67 return \Piwik\Cache::buildBackend($backend);
68 },
69 'cache.eager.cache_id' => function () {
70 return 'eagercache-' . str_replace(array('.', '-'), '', \Piwik\Version::VERSION) . '-';
71 },
72
73 'entities.idNames' => DI\add(array('idGoal', 'idDimension')),
74
75 'Psr\Log\LoggerInterface' => DI\create('Psr\Log\NullLogger'),
76
77 'Piwik\Translation\Loader\LoaderInterface' => DI\autowire('Piwik\Translation\Loader\LoaderCache')
78 ->constructorParameter('loader', DI\get('Piwik\Translation\Loader\JsonFileLoader')),
79
80 'DeviceDetector\Cache\Cache' => DI\autowire('Piwik\DeviceDetector\DeviceDetectorCache')->constructor(86400),
81
82 'observers.global' => array(),
83
84 /**
85 * 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.
86 * Thus it allows you to execute for example a newer version of Matomo with an older Matomo database version. Please note
87 * disabling this setting is not recommended because often an older DB version is not compatible with newer source code.
88 * If you disable this setting, make sure to execute the updates after updating the source code. The setting can be useful if
89 * you want to update Matomo without any outage when you know the current source code update will still run fine for a short time
90 * while in the background the database updates are running.
91 */
92 'EnableDbVersionCheck' => true,
93
94 'fileintegrity.ignore' => DI\add(array(
95 '*.htaccess',
96 '*web.config',
97 'bootstrap.php',
98 'favicon.ico',
99 'robots.txt',
100 '.bowerrc',
101 '.lfsconfig',
102 '.phpstorm.meta.php',
103 'config/config.ini.php',
104 'config/config.php',
105 'config/common.ini.php',
106 'config/*.config.ini.php',
107 'config/manifest.inc.php',
108 'misc/*.dat',
109 'misc/*.dat.gz',
110 'misc/*.mmdb',
111 'misc/*.mmdb.gz',
112 'misc/*.bin',
113 'misc/user/*png',
114 'misc/user/*svg',
115 'misc/user/*js',
116 'misc/user/*/config.ini.php',
117 'misc/package',
118 'misc/package/WebAppGallery/*.xml',
119 'misc/package/WebAppGallery/install.sql',
120 'plugins/ImageGraph/fonts/unifont.ttf',
121 'plugins/*/config/tracker.php',
122 'plugins/*/config/config.php',
123 'vendor/autoload.php',
124 'vendor/composer/autoload_real.php',
125 'vendor/szymach/c-pchart/app/*',
126 'tmp/*',
127 // Search engine sites verification
128 'google*.html',
129 'BingSiteAuth.xml',
130 'yandex*.html',
131 // common files on shared hosters
132 'php.ini',
133 '.user.ini',
134 'error_log',
135 // Files below are not expected but they used to be present in older Piwik versions and may be still here
136 // As they are not going to cause any trouble we won't report them as 'File to delete'
137 '*.coveralls.yml',
138 '*.scrutinizer.yml',
139 '*.gitignore',
140 '*.gitkeep',
141 '*.gitmodules',
142 '*.gitattributes',
143 '*.bower.json',
144 '*.travis.yml',
145 )),
146
147 'Piwik\EventDispatcher' => DI\autowire()->constructorParameter('observers', DI\get('observers.global')),
148
149 'login.allowlist.ips' => function (ContainerInterface $c) {
150 /** @var Piwik\Config\ $config */
151 $config = $c->get('Piwik\Config');
152 $general = $config->General;
153
154 $ips = array();
155 if (!empty($general['login_allowlist_ip']) && is_array($general['login_allowlist_ip'])) {
156 $ips = $general['login_allowlist_ip'];
157 } elseif (!empty($general['login_whitelist_ip']) && is_array($general['login_whitelist_ip'])) {
158 // for BC
159 $ips = $general['login_whitelist_ip'];
160 }
161
162 $ipsResolved = array();
163
164 foreach ($ips as $ip) {
165 if (filter_var($ip, FILTER_VALIDATE_IP)) {
166 $ipsResolved[] = $ip;
167 } else {
168 $ipFromHost = @gethostbyname($ip);
169 if (!empty($ipFromHost)) {
170 $ipsResolved[] = $ipFromHost;
171 }
172 }
173 }
174
175 return $ipsResolved;
176 },
177
178 'Piwik\Tracker\VisitorRecognizer' => DI\autowire()
179 ->constructorParameter('trustCookiesOnly', DI\get('ini.Tracker.trust_visitors_cookies'))
180 ->constructorParameter('visitStandardLength', DI\get('ini.Tracker.visit_standard_length'))
181 ->constructorParameter('lookbackNSecondsCustom', DI\get('ini.Tracker.window_look_back_for_visitor')),
182
183 'Piwik\Tracker\Settings' => DI\autowire()
184 ->constructorParameter('isSameFingerprintsAcrossWebsites', DI\get('ini.Tracker.enable_fingerprinting_across_websites')),
185
186 'archiving.performance.logger' => null,
187
188 \Piwik\CronArchive\Performance\Logger::class => DI\autowire()->constructorParameter('logger', DI\get('archiving.performance.logger')),
189
190 \Piwik\Concurrency\LockBackend::class => \DI\get(\Piwik\Concurrency\LockBackend\MySqlLockBackend::class),
191
192 \Piwik\Segment\SegmentsList::class => function(){
193 return \Piwik\Segment\SegmentsList::get();
194 }
195 );
196