Welcome to mirror list, hosted at ThFree Co, Russian Federation.

0.9.1.php « Updates « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f76928c31438c0bfae73d38618c24471c44ae4d3 (plain)
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
<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 * @category Piwik
 * @package Updates
 */
use Piwik\Core\Piwik;
use Piwik\Core\Common;

/**
 * @package Updates
 */
class Piwik_Updates_0_9_1 extends Piwik_Updates
{
    static function getSql($schema = 'Myisam')
    {
        if (!Piwik::isTimezoneSupportEnabled()) {
            return array();
        }
        // @see http://bugs.php.net/46111
        $timezones = timezone_identifiers_list();
        $brokenTZ = array();

        foreach ($timezones as $timezone) {
            $testDate = "2008-08-19 13:00:00 " . $timezone;

            if (!strtotime($testDate)) {
                $brokenTZ[] = $timezone;
            }
        }
        $timezoneList = '"' . implode('","', $brokenTZ) . '"';

        return array(
            'UPDATE ' . Common::prefixTable('site') . '
				SET timezone = "UTC" 
				WHERE timezone IN (' . $timezoneList . ')'                                                                  => false,

            'UPDATE `' . Common::prefixTable('option') . '`
				SET option_value = "UTC" 
			WHERE option_name = "SitesManager_DefaultTimezone" 
				AND option_value IN (' . $timezoneList . ')' => false,
        );
    }

    static function update()
    {
        if (Piwik::isTimezoneSupportEnabled()) {
            Piwik_Updater::updateDatabase(__FILE__, self::getSql());
        }
    }
}