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: 7a0b8dc7e7c0d27f8615cd5d1ecc0e40b7848e01 (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
56
<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 * @version $Id$
 *
 * @category Piwik
 * @package Updates
 */

/**
 * @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 '. Piwik_Common::prefixTable('site') .'
				SET timezone = "UTC" 
				WHERE timezone IN ('. $timezoneList .')' => false,

			'UPDATE `'. Piwik_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());
		}
	}
}