PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.3.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.3.1
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 6 years ago global.ini.php 6 years ago global.php 5 years ago
global.php
224 lines
1 <?php
2
3 use Interop\Container\ContainerInterface;
4 use Interop\Container\Exception\NotFoundException;
5 use Piwik\Cache\Eager;
6 use Piwik\SettingsServer;
7 use Piwik\Config;
8
9 return array(
10
11 'path.root' => PIWIK_DOCUMENT_ROOT,
12
13 'path.misc.user' => 'misc/user/',
14
15 'path.tmp' => function (ContainerInterface $c) {
16 $root = PIWIK_USER_PATH;
17
18 // TODO remove that special case and instead have plugins override 'path.tmp' to add the instance id
19 if ($c->has('ini.General.instance_id')) {
20 $instanceId = $c->get('ini.General.instance_id');
21 $instanceId = $instanceId ? '/' . $instanceId : '';
22 } else {
23 $instanceId = '';
24 }
25
26 /** @var Piwik\Config\ $config */
27 $config = $c->get('Piwik\Config');
28 $general = $config->General;
29 $tmp = empty($general['tmp_path']) ? '/tmp' : $general['tmp_path'];
30
31 return $root . $tmp . $instanceId;
32 },
33
34 'path.cache' => DI\string('{path.tmp}/cache/tracker/'),
35
36 'Piwik\Cache\Eager' => function (ContainerInterface $c) {
37 $backend = $c->get('Piwik\Cache\Backend');
38 $cacheId = $c->get('cache.eager.cache_id');
39
40 if (SettingsServer::isTrackerApiRequest()) {
41 $eventToPersist = 'Tracker.end';
42 $cacheId .= 'tracker';
43 } else {
44 $eventToPersist = 'Request.dispatch.end';
45 $cacheId .= 'ui';
46 }
47
48 $cache = new Eager($backend, $cacheId);
49 \Piwik\Piwik::addAction($eventToPersist, function () use ($cache) {
50 $cache->persistCacheIfNeeded(43200);
51 });
52
53 return $cache;
54 },
55 'Piwik\Cache\Backend' => function (ContainerInterface $c) {
56 // If Piwik is not installed yet, it's possible the tmp/ folder is not writable
57 // we prevent failing with an unclear message eg. coming from doctrine-cache
58 // by forcing to use a cache backend which always works ie. array
59 if(!\Piwik\SettingsPiwik::isPiwikInstalled()) {
60 $backend = 'array';
61 } else {
62 try {
63 $backend = $c->get('ini.Cache.backend');
64 } catch (NotFoundException $ex) {
65 $backend = 'chained'; // happens if global.ini.php is not available
66 }
67 }
68
69 return \Piwik\Cache::buildBackend($backend);
70 },
71 'cache.eager.cache_id' => function () {
72 return 'eagercache-' . str_replace(array('.', '-'), '', \Piwik\Version::VERSION) . '-';
73 },
74
75 'entities.idNames' => DI\add(array('idGoal', 'idDimension')),
76
77 'Psr\Log\LoggerInterface' => DI\object('Psr\Log\NullLogger'),
78
79 'Piwik\Translation\Loader\LoaderInterface' => DI\object('Piwik\Translation\Loader\LoaderCache')
80 ->constructor(DI\get('Piwik\Translation\Loader\JsonFileLoader')),
81
82 'DeviceDetector\Cache\Cache' => DI\object('Piwik\DeviceDetector\DeviceDetectorCache')->constructor(86400),
83
84 'observers.global' => array(),
85
86 /**
87 * 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.
88 * Thus it allows you to execute for example a newer version of Matomo with an older Matomo database version. Please note
89 * disabling this setting is not recommended because often an older DB version is not compatible with newer source code.
90 * If you disable this setting, make sure to execute the updates after updating the source code. The setting can be useful if
91 * you want to update Matomo without any outage when you know the current source code update will still run fine for a short time
92 * while in the background the database updates are running.
93 */
94 'EnableDbVersionCheck' => true,
95
96 'fileintegrity.ignore' => DI\add(array(
97 '*.htaccess',
98 '*web.config',
99 'bootstrap.php',
100 'favicon.ico',
101 'robots.txt',
102 '.bowerrc',
103 '.lfsconfig',
104 '.phpstorm.meta.php',
105 'config/config.ini.php',
106 'config/config.php',
107 'config/common.ini.php',
108 'config/*.config.ini.php',
109 'config/manifest.inc.php',
110 'misc/*.dat',
111 'misc/*.dat.gz',
112 'misc/*.mmdb',
113 'misc/*.mmdb.gz',
114 'misc/*.bin',
115 'misc/user/*png',
116 'misc/user/*svg',
117 'misc/user/*js',
118 'misc/user/*/config.ini.php',
119 'misc/package',
120 'misc/package/WebAppGallery/*.xml',
121 'misc/package/WebAppGallery/install.sql',
122 'plugins/ImageGraph/fonts/unifont.ttf',
123 'plugins/*/config/tracker.php',
124 'plugins/*/config/config.php',
125 'vendor/autoload.php',
126 'vendor/composer/autoload_real.php',
127 'vendor/szymach/c-pchart/app/*',
128 'tmp/*',
129 // Search engine sites verification
130 'google*.html',
131 'BingSiteAuth.xml',
132 'yandex*.html',
133 // common files on shared hosters
134 'php.ini',
135 '.user.ini',
136 // Files below are not expected but they used to be present in older Piwik versions and may be still here
137 // As they are not going to cause any trouble we won't report them as 'File to delete'
138 '*.coveralls.yml',
139 '*.scrutinizer.yml',
140 '*.gitignore',
141 '*.gitkeep',
142 '*.gitmodules',
143 '*.gitattributes',
144 '*.bower.json',
145 '*.travis.yml',
146 )),
147
148 'Piwik\EventDispatcher' => DI\object()->constructorParameter('observers', DI\get('observers.global')),
149
150 'login.whitelist.ips' => function (ContainerInterface $c) {
151 /** @var Piwik\Config\ $config */
152 $config = $c->get('Piwik\Config');
153 $general = $config->General;
154
155 $ips = array();
156 if (!empty($general['login_whitelist_ip']) && is_array($general['login_whitelist_ip'])) {
157 $ips = $general['login_whitelist_ip'];
158 }
159
160 $ipsResolved = array();
161
162 foreach ($ips as $ip) {
163 if (filter_var($ip, FILTER_VALIDATE_IP)) {
164 $ipsResolved[] = $ip;
165 } else {
166 $ipFromHost = @gethostbyname($ip);
167 if (!empty($ipFromHost)) {
168 $ipsResolved[] = $ipFromHost;
169 }
170 }
171 }
172
173 return $ipsResolved;
174 },
175 'Zend_Mail_Transport_Abstract' => function () {
176 $mailConfig = Config::getInstance()->mail;
177
178 if (empty($mailConfig['host'])
179 || $mailConfig['transport'] != 'smtp'
180 ) {
181 return;
182 }
183
184 $smtpConfig = array();
185 if (!empty($mailConfig['type'])) {
186 $smtpConfig['auth'] = strtolower($mailConfig['type']);
187 }
188
189 if (!empty($mailConfig['username'])) {
190 $smtpConfig['username'] = $mailConfig['username'];
191 }
192
193 if (!empty($mailConfig['password'])) {
194 $smtpConfig['password'] = $mailConfig['password'];
195 }
196
197 if (!empty($mailConfig['encryption'])) {
198 $smtpConfig['ssl'] = $mailConfig['encryption'];
199 }
200
201 if (!empty($mailConfig['port'])) {
202 $smtpConfig['port'] = $mailConfig['port'];
203 }
204
205 $host = trim($mailConfig['host']);
206 $transport = new \Zend_Mail_Transport_Smtp($host, $smtpConfig);
207 return $transport;
208 },
209
210 'Piwik\Tracker\VisitorRecognizer' => DI\object()
211 ->constructorParameter('trustCookiesOnly', DI\get('ini.Tracker.trust_visitors_cookies'))
212 ->constructorParameter('visitStandardLength', DI\get('ini.Tracker.visit_standard_length'))
213 ->constructorParameter('lookbackNSecondsCustom', DI\get('ini.Tracker.window_look_back_for_visitor')),
214
215 'Piwik\Tracker\Settings' => DI\object()
216 ->constructorParameter('isSameFingerprintsAcrossWebsites', DI\get('ini.Tracker.enable_fingerprinting_across_websites')),
217
218 'archiving.performance.logger' => null,
219
220 \Piwik\CronArchive\Performance\Logger::class => DI\object()->constructorParameter('logger', DI\get('archiving.performance.logger')),
221
222 \Piwik\Concurrency\LockBackend::class => \DI\get(\Piwik\Concurrency\LockBackend\MySqlLockBackend::class),
223 );
224