Preserve x-custom data in cache, even when object is saved by a client that doesn't support custom fields (#2238)
This commit is contained in:
parent
42ecb43629
commit
20c0706d9d
1 changed files with 10 additions and 2 deletions
|
@ -403,14 +403,22 @@ abstract class kolab_format
|
|||
$this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC')));
|
||||
|
||||
// Save custom properties of the given object
|
||||
if (!empty($object['x-custom'])) {
|
||||
if (isset($object['x-custom'])) {
|
||||
$vcustom = new vectorcs;
|
||||
foreach ($object['x-custom'] as $cp) {
|
||||
foreach ((array)$object['x-custom'] as $cp) {
|
||||
if (is_array($cp))
|
||||
$vcustom->push(new CustomProperty($cp[0], $cp[1]));
|
||||
}
|
||||
$this->obj->setCustomProperties($vcustom);
|
||||
}
|
||||
else { // load custom properties from XML for caching (#2238)
|
||||
$object['x-custom'] = array();
|
||||
$vcustom = $this->obj->customProperties();
|
||||
for ($i=0; $i < $vcustom->size(); $i++) {
|
||||
$cp = $vcustom->get($i);
|
||||
$object['x-custom'][] = array($cp->identifier, $cp->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue