-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathConfig.php
More file actions
76 lines (69 loc) · 2.85 KB
/
Config.php
File metadata and controls
76 lines (69 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Piwik\Plugins\ClickHeat;
use Piwik\Plugins\ClickHeat\Utils\Configurable;
class Config
{
use Configurable;
/**
* Config constructor.
*/
public static function init()
{
$settings = new SystemSettings();
self::mergeSystemSettings($settings);
self::$config = self::$configurations;
self::set('logPath', PIWIK_INCLUDE_PATH . self::get('logPath'));
self::set('cachePath', PIWIK_INCLUDE_PATH . self::get('cachePath'));
// TODO: refactor configuration
}
static $configurations = [
// will be override by system settings
'checkReferrer' => false,
'redis' => [
'sentinel' => '',
'password' => '',
'database' => 0,
'host' => 'localhost',
'port' => '6379',
],
// TODO: below configurations need to be refactored
'logger' => 'Piwik\Plugins\ClickHeat\Logger\MysqlLogger',
'adapter' => 'Piwik\Plugins\ClickHeat\Adapter\MysqlHeatmapAdapter',
'logPath' => '/tmp/cache/clickheat/logs/',
'cachePath' => '/tmp/cache/clickheat/cache/',
'fileSize' => 0,
'memory' => 0,
'timeout' => 180,
'step' => 5,
'dot' => 19,
'flush' => 40, //days
'start' => 'm',
'palette' => false,
'heatmap' => true,
'hideIframes' => true,
'hideFlashes' => true,
'yesterday' => false,
'alpha' => 80,
'version' => '0.1.9',
'__screenSizes' => [0/** Must start with 0 */, 640, 800, 1024, 1280, 1440, 1600, 1800],
'__browsersList' => ['all' => '', 'firefox' => 'Firefox', 'chrome' => 'Google Chrome', 'msie' => 'Internet Explorer', 'safari' => 'Safari', 'opera' => 'Opera', 'kmeleon' => 'K-meleon', 'unknown' => ''],
];
/**
* @param SystemSettings $settings
*/
private static function mergeSystemSettings(SystemSettings $settings)
{
$sentinelMaster = $settings->useSentinelBackend->getValue() ? $settings->sentinelMasterName->getValue() : null;
$redisConfigs = [
'sentinel' => $sentinelMaster,
'database' => $settings->redisDatabase->getValue(),
'password' => $settings->redisPassword->getValue() ? $settings->redisPassword->getValue() : null,
'host' => $settings->redisHost->getValue(),
'port' => $settings->redisPort->getValue(),
];
self::$configurations['redis'] = $redisConfigs;
self::$configurations['checkReferrer'] = $settings->checkReferrer->getValue();
self::$configurations['memory'] = $settings->memory->getValue();
self::$configurations['timeout'] = $settings->timeout->getValue();
}
}