Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117925412
D4265.1775447444.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None
D4265.1775447444.diff
View Options
diff --git a/lib/kolab_sync_data_calendar.php b/lib/kolab_sync_data_calendar.php
--- a/lib/kolab_sync_data_calendar.php
+++ b/lib/kolab_sync_data_calendar.php
@@ -194,7 +194,7 @@
if ($timezone && ($tz_name = $timezone->getName()) != 'UTC') {
$tzc = kolab_sync_timezone_converter::getInstance();
- if ($tz_name = $tzc->encodeTimezone($tz_name)) {
+ if ($tz_name = $tzc->encodeTimezone($tz_name, $event['start']->format('Y-m-d'))) {
$result['timezone'] = $tz_name;
}
}
diff --git a/lib/kolab_sync_timezone_converter.php b/lib/kolab_sync_timezone_converter.php
--- a/lib/kolab_sync_timezone_converter.php
+++ b/lib/kolab_sync_timezone_converter.php
@@ -151,18 +151,12 @@
}
$this->_setDefaultStartDateIfEmpty($_offsets);
- $cacheId = $this->_getCacheId('timezones', $_offsets);
- $timezones = $this->_loadFromCache($cacheId);
-
- if (!is_array($timezones)) {
- $timezones = array();
- foreach (DateTimeZone::listIdentifiers() as $timezoneIdentifier) {
- $timezone = new DateTimeZone($timezoneIdentifier);
- if (false !== ($matchingTransition = $this->_checkTimezone($timezone, $_offsets))) {
- $timezones[$timezoneIdentifier] = $matchingTransition['abbr'];
- }
+ $timezones = array();
+ foreach (DateTimeZone::listIdentifiers() as $timezoneIdentifier) {
+ $timezone = new DateTimeZone($timezoneIdentifier);
+ if (false !== ($matchingTransition = $this->_checkTimezone($timezone, $_offsets))) {
+ $timezones[$timezoneIdentifier] = $matchingTransition['abbr'];
}
- $this->_saveInCache($timezones, $cacheId);
}
}
@@ -224,36 +218,30 @@
{
$this->_setStartDate($_startDate);
- $cacheId = $this->_getCacheId('offsets', array($_timezone));
+ $offsets = $this->_getOffsetsTemplate();
- if (!($offsets = $this->_loadFromCache($cacheId))) {
- $offsets = $this->_getOffsetsTemplate();
-
- try {
- $timezone = new DateTimeZone($_timezone);
- }
- catch (Exception $e) {
- return null;
- }
+ try {
+ $timezone = new DateTimeZone($_timezone);
+ }
+ catch (Exception $e) {
+ return null;
+ }
- list($standardTransition, $daylightTransition) = $this->_getTransitionsForTimezoneAndYear($timezone, $this->_startDate['year']);
+ list($standardTransition, $daylightTransition) = $this->_getTransitionsForTimezoneAndYear($timezone, $this->_startDate['year']);
- if ($standardTransition) {
- $offsets['bias'] = $standardTransition['offset']/60*-1;
- if ($daylightTransition) {
- $offsets = $this->_generateOffsetsForTransition($offsets, $standardTransition, 'standard', $timezone);
- $offsets = $this->_generateOffsetsForTransition($offsets, $daylightTransition, 'daylight', $timezone);
+ if ($standardTransition) {
+ $offsets['bias'] = $standardTransition['offset']/60*-1;
+ if ($daylightTransition) {
+ $offsets = $this->_generateOffsetsForTransition($offsets, $standardTransition, 'standard', $timezone);
+ $offsets = $this->_generateOffsetsForTransition($offsets, $daylightTransition, 'daylight', $timezone);
- //@todo how do we get the standardBias (is usually 0)?
- //$offsets['standardBias'] = ...
+ //@todo how do we get the standardBias (is usually 0)?
+ //$offsets['standardBias'] = ...
- $offsets['daylightBias'] = ($daylightTransition['offset'] - $standardTransition['offset'])/60*-1;
- $offsets['standardHour'] -= $offsets['daylightBias'] / 60;
- $offsets['daylightHour'] += $offsets['daylightBias'] / 60;
- }
+ $offsets['daylightBias'] = ($daylightTransition['offset'] - $standardTransition['offset'])/60*-1;
+ $offsets['standardHour'] -= $offsets['daylightBias'] / 60;
+ $offsets['daylightHour'] += $offsets['daylightBias'] / 60;
}
-
- $this->_saveInCache($offsets, $cacheId);
}
return $offsets;
@@ -636,39 +624,4 @@
return array($standardTransition, $daylightTransition);
}
-
- protected function _getCacheId($_prefix, $_offsets)
- {
- return $_prefix . md5(serialize($_offsets));
- }
-
- protected function _loadFromCache($key)
- {
- if ($cache = $this->getCache()) {
- return $cache->get($key);
- }
-
- return false;
- }
-
- protected function _saveInCache($value, $key)
- {
- if ($cache = $this->getCache()) {
- $cache->set($key, $value);
- }
- }
-
- /**
- * Getter for the cache engine object
- */
- protected function getCache()
- {
- if ($this->cache === null) {
- $rcube = rcube::get_instance();
- $cache = $rcube->get_cache_shared('activesync');
- $this->cache = $cache ? $cache : false;
- }
-
- return $this->cache;
- }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 6, 3:50 AM (1 d, 8 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18834167
Default Alt Text
D4265.1775447444.diff (5 KB)
Attached To
Mode
D4265: Fixed timezone conversion with changing timezones
Attached
Detach File
Event Timeline