PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.0.5
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.0.5
5.13.0 5.12.1 5.12.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 6 years ago global.ini.php 6 years ago global.php 6 years ago
global.php
222 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 '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 // Files below are not expected but they used to be present in older Piwik versions and may be still here
135 // As they are not going to cause any trouble we won't report them as 'File to delete'
136 '*.coveralls.yml',
137 '*.scrutinizer.yml',
138 '*.gitignore',
139 '*.gitkeep',
140 '*.gitmodules',
141 '*.gitattributes',
142 '*.bower.json',
143 '*.travis.yml',
144 )),
145
146 'Piwik\EventDispatcher' => DI\object()->constructorParameter('observers', DI\get('observers.global')),
147
148 'login.whitelist.ips' => function (ContainerInterface $c) {
149 /** @var Piwik\Config\ $config */
150 $config = $c->get('Piwik\Config');
151 $general = $config->General;
152
153 $ips = array();
154 if (!empty($general['login_whitelist_ip']) && is_array($general['login_whitelist_ip'])) {
155 $ips = $general['login_whitelist_ip'];
156 }
157
158 $ipsResolved = array();
159
160 foreach ($ips as $ip) {
161 if (filter_var($ip, FILTER_VALIDATE_IP)) {
162 $ipsResolved[] = $ip;
163 } else {
164 $ipFromHost = @gethostbyname($ip);
165 if (!empty($ipFromHost)) {
166 $ipsResolved[] = $ipFromHost;
167 }
168 }
169 }
170
171 return $ipsResolved;
172 },
173 'Zend_Mail_Transport_Abstract' => function () {
174 $mailConfig = Config::getInstance()->mail;
175
176 if (empty($mailConfig['host'])
177 || $mailConfig['transport'] != 'smtp'
178 ) {
179 return;
180 }
181
182 $smtpConfig = array();
183 if (!empty($mailConfig['type'])) {
184 $smtpConfig['auth'] = strtolower($mailConfig['type']);
185 }
186
187 if (!empty($mailConfig['username'])) {
188 $smtpConfig['username'] = $mailConfig['username'];
189 }
190
191 if (!empty($mailConfig['password'])) {
192 $smtpConfig['password'] = $mailConfig['password'];
193 }
194
195 if (!empty($mailConfig['encryption'])) {
196 $smtpConfig['ssl'] = $mailConfig['encryption'];
197 }
198
199 if (!empty($mailConfig['port'])) {
200 $smtpConfig['port'] = $mailConfig['port'];
201 }
202
203 $host = trim($mailConfig['host']);
204 $transport = new \Zend_Mail_Transport_Smtp($host, $smtpConfig);
205 return $transport;
206 },
207
208 'Piwik\Tracker\VisitorRecognizer' => DI\object()
209 ->constructorParameter('trustCookiesOnly', DI\get('ini.Tracker.trust_visitors_cookies'))
210 ->constructorParameter('visitStandardLength', DI\get('ini.Tracker.visit_standard_length'))
211 ->constructorParameter('lookbackNSecondsCustom', DI\get('ini.Tracker.window_look_back_for_visitor')),
212
213 'Piwik\Tracker\Settings' => DI\object()
214 ->constructorParameter('isSameFingerprintsAcrossWebsites', DI\get('ini.Tracker.enable_fingerprinting_across_websites')),
215
216 'archiving.performance.logger' => null,
217
218 \Piwik\CronArchive\Performance\Logger::class => DI\object()->constructorParameter('logger', DI\get('archiving.performance.logger')),
219
220 \Piwik\Concurrency\LockBackend::class => \DI\get(\Piwik\Concurrency\LockBackend\MySqlLockBackend::class),
221 );
222