Minor code improvements

This commit is contained in:
Thomas Bruederli 2013-10-07 12:12:23 +02:00
parent b72709a5cf
commit 20a731c540
3 changed files with 8 additions and 7 deletions

View file

@ -41,11 +41,7 @@ class kolab_storage_cache
protected $folders_table;
protected $max_sql_packet;
protected $max_sync_lock_time = 600;
protected $binary_items = array(
'photo' => '|<photo><uri>[^;]+;base64,([^<]+)</uri></photo>|i',
'pgppublickey' => '|<key><uri>date:application/pgp-keys;base64,([^<]+)</uri></photo>|i',
'pkcs7publickey' => '|<key><uri>date:application/pkcs7-mime;base64,([^<]+)</uri></photo>|i',
);
protected $binary_items = array();
protected $extra_cols = array();
@ -600,7 +596,7 @@ class kolab_storage_cache
*/
protected function _serialize($object)
{
$sql_data = array('changed' => null, 'dtstart' => null, 'dtend' => null, 'xml' => '', 'tags' => '', 'words' => '');
$sql_data = array('changed' => null, 'xml' => '', 'tags' => '', 'words' => '');
if ($object['changed']) {
$sql_data['changed'] = date('Y-m-d H:i:s', is_object($object['changed']) ? $object['changed']->format('U') : $object['changed']);

View file

@ -24,6 +24,11 @@
class kolab_storage_cache_contact extends kolab_storage_cache
{
protected $extra_cols = array('type');
protected $binary_items = array(
'photo' => '|<photo><uri>[^;]+;base64,([^<]+)</uri></photo>|i',
'pgppublickey' => '|<key><uri>date:application/pgp-keys;base64,([^<]+)</uri></photo>|i',
'pkcs7publickey' => '|<key><uri>date:application/pkcs7-mime;base64,([^<]+)</uri></photo>|i',
);
/**
* Helper method to convert the given Kolab object into a dataset to be written to cache

View file

@ -32,7 +32,7 @@ class kolab_storage_cache_task extends kolab_storage_cache
*/
protected function _serialize($object)
{
$sql_data = parent::_serialize($object);
$sql_data = parent::_serialize($object) + array('dtstart' => null, 'dtend' => null);
if ($object['start'])
$sql_data['dtstart'] = date('Y-m-d H:i:s', is_object($object['start']) ? $object['start']->format('U') : $object['start']);