PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.2.0
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.2.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 1 year ago global.ini.php 1 year ago global.php 1 year ago
global.php
208 lines
1 <?php
2
3 namespace {
4 use Matomo\Cache\Eager;
5 use Piwik\SettingsServer;
6 return [
7 'path.root' => \PIWIK_DOCUMENT_ROOT,
8 'path.misc.user' => 'misc/user/',
9 'path.tmp' => function (\Piwik\Container\Container $c) {
10 $root = \PIWIK_USER_PATH;
11 // TODO remove that special case and instead have plugins override 'path.tmp' to add the instance id
12 if ($c->has('ini.General.instance_id')) {
13 $instanceId = $c->get('ini.General.instance_id');
14 $instanceId = $instanceId ? '/' . $instanceId : '';
15 } else {
16 $instanceId = '';
17 }
18 /** @var Piwik\Config\ $config */
19 $config = $c->get('Piwik\\Config');
20 $general = $config->General;
21 $tmp = empty($general['tmp_path']) ? '/tmp' : $general['tmp_path'];
22 return $root . $tmp . $instanceId;
23 },
24 'path.tmp.templates' => \Piwik\DI::string('{path.tmp}/templates_c'),
25 'path.cache' => \Piwik\DI::string('{path.tmp}/cache/tracker/'),
26 'view.clearcompiledtemplates.enable' => \true,
27 'twig.cache' => \Piwik\DI::string('{path.tmp.templates}'),
28 'Matomo\\Cache\\Eager' => function (\Piwik\Container\Container $c) {
29 $backend = $c->get('Matomo\\Cache\\Backend');
30 $cacheId = $c->get('cache.eager.cache_id');
31 if (SettingsServer::isTrackerApiRequest()) {
32 $eventToPersist = 'Tracker.end';
33 $cacheId .= 'tracker';
34 } else {
35 $eventToPersist = 'Request.dispatch.end';
36 $cacheId .= 'ui';
37 }
38 $cache = new Eager($backend, $cacheId);
39 \Piwik\Piwik::addAction($eventToPersist, function () use($cache) {
40 $cache->persistCacheIfNeeded(43200);
41 });
42 return $cache;
43 },
44 'Matomo\\Cache\\Backend' => function (\Piwik\Container\Container $c) {
45 // If Piwik is not installed yet, it's possible the tmp/ folder is not writable
46 // we prevent failing with an unclear message eg. coming from doctrine-cache
47 // by forcing to use a cache backend which always works ie. array
48 if (!\Piwik\SettingsPiwik::isMatomoInstalled()) {
49 $backend = 'array';
50 } else {
51 try {
52 $backend = $c->get('ini.Cache.backend');
53 } catch (\Piwik\Exception\DI\NotFoundException $ex) {
54 $backend = 'chained';
55 // happens if global.ini.php is not available
56 }
57 }
58 return \Piwik\Cache::buildBackend($backend);
59 },
60 'cache.eager.cache_id' => function () {
61 return 'eagercache-' . \str_replace(['.', '-'], '', \Piwik\Version::VERSION) . '-';
62 },
63 /**
64 * A list of API query parameters that map to entity IDs, for example, `idGoal` for goals.
65 *
66 * If your plugin introduces new entities that can be fetched or manipulated by ID through
67 * API requests, you should add the query parameters that represent the new entity's IDs
68 * to this array.
69 */
70 'entities.idNames' => \Piwik\DI::add(['idGoal', 'idDimension']),
71 /**
72 * If your plugin uses custom query parameters in API requests (that is, query parameters not used
73 * by a core plugin), and you want to be able to use those query parameters in system tests, you
74 * will need to add them, via DI, to this array. Otherwise, in system tests, they will be
75 * silently ignored.
76 *
77 * Note: if the query parameter has been added to `'entities.idNames'`, it does not need to be added
78 * here as well.
79 */
80 'DocumentationGenerator.customParameters' => [],
81 \Piwik\Log\LoggerInterface::class => \Piwik\DI::create(\Piwik\Log\NullLogger::class),
82 'Piwik\\Translation\\Loader\\LoaderInterface' => \Piwik\DI::autowire('Piwik\\Translation\\Loader\\LoaderCache')->constructorParameter('loader', \Piwik\DI::get('Piwik\\Translation\\Loader\\JsonFileLoader')),
83 'DeviceDetector\\Cache\\Cache' => \Piwik\DI::autowire('Piwik\\DeviceDetector\\DeviceDetectorCache')->constructor(86400),
84 // specify plugins to load on demand via DI config. mostly for tests.
85 'plugins.shouldLoadOnDemand' => [],
86 // allow users to override plugin hardcoded value and avoid loading on demand
87 'plugins.shouldNotLoadOnDemand' => [],
88 'observers.global' => [],
89 'dev.forced_plugin_update_result' => null,
90 /**
91 * By setting this option to false, the check that the DB schema version matches the version of the source code will
92 * be no longer performed. Thus it allows you to execute for example a newer version of Matomo with an older Matomo
93 * database version. Please note disabling this setting is not recommended because often an older DB version is not
94 * compatible with newer source code.
95 * If you disable this setting, make sure to execute the updates after updating the source code. The setting can be
96 * useful if you want to update Matomo without any outage when you know the current source code update will still
97 * run fine for a short time while in the background the database updates are running.
98 */
99 'EnableDbVersionCheck' => \true,
100 'fileintegrity.ignore' => \Piwik\DI::add([
101 '*.htaccess',
102 '*web.config',
103 'bootstrap.php',
104 'favicon.ico',
105 'robots.txt',
106 '.bowerrc',
107 '.lfsconfig',
108 '.phpstorm.meta.php',
109 'config/config.ini.php',
110 'config/config.php',
111 'config/common.ini.php',
112 'config/*.config.ini.php',
113 'config/manifest.inc.php',
114 'misc/*.dat',
115 'misc/*.dat.gz',
116 'misc/*.mmdb',
117 'misc/*.mmdb.gz',
118 'misc/*.bin',
119 'misc/user/*png',
120 'misc/user/*svg',
121 'misc/user/*js',
122 'misc/user/*/config.ini.php',
123 'misc/package',
124 'misc/package/WebAppGallery/*.xml',
125 'misc/package/WebAppGallery/install.sql',
126 'plugins/ImageGraph/fonts/unifont.ttf',
127 'plugins/*/config/tracker.php',
128 'plugins/*/config/config.php',
129 'vendor/autoload.php',
130 'vendor/composer/autoload_real.php',
131 'vendor/szymach/c-pchart/app/*',
132 'tmp/*',
133 // Search engine sites verification
134 'google*.html',
135 'BingSiteAuth.xml',
136 'yandex*.html',
137 // common files on shared hosters
138 'php.ini',
139 '.user.ini',
140 'error_log',
141 // Files below are not expected but they used to be present in older Piwik versions and may be still here
142 // As they are not going to cause any trouble we won't report them as 'File to delete'
143 '*.coveralls.yml',
144 '*.scrutinizer.yml',
145 '*.gitignore',
146 '*.gitkeep',
147 '*.gitmodules',
148 '*.gitattributes',
149 '*.git-blame-ignore-revs',
150 '*.bower.json',
151 '*.travis.yml',
152 ]),
153 'Piwik\\EventDispatcher' => \Piwik\DI::autowire()->constructorParameter('observers', \Piwik\DI::get('observers.global')),
154 'login.allowlist.ips' => function (\Piwik\Container\Container $c) {
155 /** @var Piwik\Config\ $config */
156 $config = $c->get('Piwik\\Config');
157 $general = $config->General;
158 $ips = [];
159 if (!empty($general['login_allowlist_ip']) && \is_array($general['login_allowlist_ip'])) {
160 $ips = $general['login_allowlist_ip'];
161 } elseif (!empty($general['login_whitelist_ip']) && \is_array($general['login_whitelist_ip'])) {
162 // for BC
163 $ips = $general['login_whitelist_ip'];
164 }
165 $ipsResolved = [];
166 foreach ($ips as $ip) {
167 $ip = \trim($ip);
168 if (\filter_var($ip, \FILTER_VALIDATE_IP) || \Matomo\Network\IPUtils::getIPRangeBounds($ip) !== null) {
169 $ipsResolved[] = $ip;
170 } else {
171 $lazyCache = \Piwik\Cache::getLazyCache();
172 $cacheKey = 'DNS.' . \md5($ip);
173 $resolvedIps = $lazyCache->fetch($cacheKey);
174 if (!\is_array($resolvedIps)) {
175 $resolvedIps = [];
176 $ipFromHost = @\gethostbyname($ip);
177 if (!empty($ipFromHost) && $ipFromHost !== $ip) {
178 $resolvedIps[] = $ipFromHost;
179 }
180 if (\function_exists('dns_get_record')) {
181 $entry = @\dns_get_record($ip, \DNS_AAAA);
182 if (!empty($entry['0']['ipv6']) && \filter_var($entry['0']['ipv6'], \FILTER_VALIDATE_IP)) {
183 $resolvedIps[] = $entry['0']['ipv6'];
184 }
185 }
186 $lazyCache->save($cacheKey, $resolvedIps, 30);
187 }
188 $ipsResolved = \array_merge($ipsResolved, $resolvedIps);
189 }
190 }
191 return $ipsResolved;
192 },
193 /**
194 * This defines a list of hostnames Matomo's Http class will deny requests to. Wildcards (*) can be used in the
195 * beginning to match any subdomain level or in the end to match any tlds
196 */
197 'http.blocklist.hosts' => ['*.amazonaws.com'],
198 'Piwik\\Tracker\\VisitorRecognizer' => \Piwik\DI::autowire()->constructorParameter('trustCookiesOnly', \Piwik\DI::get('ini.Tracker.trust_visitors_cookies'))->constructorParameter('visitStandardLength', \Piwik\DI::get('ini.Tracker.visit_standard_length'))->constructorParameter('lookbackNSecondsCustom', \Piwik\DI::get('ini.Tracker.window_look_back_for_visitor')),
199 'Piwik\\Tracker\\Settings' => \Piwik\DI::autowire()->constructorParameter('isSameFingerprintsAcrossWebsites', \Piwik\DI::get('ini.Tracker.enable_fingerprinting_across_websites')),
200 'archiving.performance.logger' => null,
201 \Piwik\CronArchive\Performance\Logger::class => \Piwik\DI::autowire()->constructorParameter('logger', \Piwik\DI::get('archiving.performance.logger')),
202 \Piwik\Concurrency\LockBackend::class => \Piwik\DI::get(\Piwik\Concurrency\LockBackend\MySqlLockBackend::class),
203 \Piwik\Segment\SegmentsList::class => function () {
204 return \Piwik\Segment\SegmentsList::get();
205 },
206 ];
207 }
208