diff options
author | Stefan Giehl <stefan@piwik.org> | 2016-10-05 00:30:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-05 00:30:09 +0300 |
commit | 7e0cc29659aa797a2365499fc9edabae56433e65 (patch) | |
tree | 435fc9134c2fc3ef3f95a438d7d3889f67b927ad | |
parent | d3c5f504e2f51e652d27215ce74c1b92e71c903b (diff) | |
parent | b8d15f6e8db5fa09811884d9eab0ad67190d8f55 (diff) |
Merge pull request #10681 from piwik/updatefix_3
Fix update script screwing up scheduled report data (3.x)
-rw-r--r-- | core/Date.php | 6 | ||||
-rw-r--r-- | core/Updates/2.16.5.php (renamed from core/Updates/2.16.3-b3.php) | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/core/Date.php b/core/Date.php index 8922ed8ac2..dd2051a1a0 100644 --- a/core/Date.php +++ b/core/Date.php @@ -258,7 +258,7 @@ class Date } /** - * Converts a timestamp in a from UTC to a timezone. + * Converts a timestamp from UTC to a timezone. * * @param int $timestamp The UNIX timestamp to adjust. * @param string $timezone The timezone to adjust to. @@ -266,6 +266,10 @@ class Date */ public static function adjustForTimezone($timestamp, $timezone) { + if (empty($timezone)) { + return $timestamp; + } + // manually adjust for UTC timezones $utcOffset = self::extractUtcOffset($timezone); if ($utcOffset !== false) { diff --git a/core/Updates/2.16.3-b3.php b/core/Updates/2.16.5.php index ba57839d57..c5aef85066 100644 --- a/core/Updates/2.16.3-b3.php +++ b/core/Updates/2.16.5.php @@ -16,19 +16,19 @@ use Piwik\Updater; use Piwik\Updates as PiwikUpdates; /** - * Update for version 2.16.3-b3. + * Update for version 2.16.5. * * Update existing scheduled reports to use UTC timezone for hour setting */ -class Updates_2_16_3_b3 extends PiwikUpdates +class Updates_2_16_5 extends PiwikUpdates { public function doUpdate(Updater $updater) { $model = new ScheduledReportsModel(); $allReports = ScheduledReportsAPI::getInstance()->getReports(); foreach ($allReports as $report) { - $report['hour'] = $this->adjustTimezoneBySite($report['hour'], $report['idsite']); - $model->updateReport($report['idreport'], $report); + $update = array('hour' => $this->adjustTimezoneBySite($report['hour'], $report['idsite'])); + $model->updateReport($report['idreport'], $update); } } |