Unset kolab_format object reference to reduce footprint; fix DateTime conversion

This commit is contained in:
Thomas B 2012-03-30 19:07:56 +02:00
parent 70c42619cd
commit 5feac6ed7b
3 changed files with 11 additions and 2 deletions

View file

@ -61,8 +61,11 @@ abstract class kolab_format
if (!$tz) $tz = self::$timezone;
$result = new cDateTime();
if (is_numeric($datetime))
$datetime = new DateTime('@'.$datetime, $tz);
// got a unix timestamp (in UTC)
if (is_numeric($datetime)) {
$datetime = new DateTime('@'.$datetime, new DateTimeZone('UTC'));
if ($tz) $datetime->setTimezone($tz);
}
else if (is_string($datetime) && strlen($datetime))
$datetime = new DateTime($datetime, $tz);
@ -71,6 +74,7 @@ abstract class kolab_format
if (!$dateonly)
$result->setTime($datetime->format('G'), $datetime->format('i'), $datetime->format('s'));
if ($tz)
$result->setTimezone($tz->getName());
}

View file

@ -274,6 +274,7 @@ class kolab_format_contact extends kolab_format
// cache this data
unset($object['_formatobj']);
$this->data = $object;
}

View file

@ -77,6 +77,10 @@ class kolab_format_distributionlist extends kolab_format
}
$this->obj->setMembers($members);
// cache this data
unset($object['_formatobj']);
$this->data = $object;
}
public function is_valid()