Skip to content

Commit

Permalink
Ensure the initial collections object is written to storage.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Mar 25, 2014
1 parent 3834fd8 commit 5a0e1d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions framework/ActiveSync/lib/Horde/ActiveSync/State/Mongo.php
Expand Up @@ -1147,20 +1147,23 @@ public function getSyncCache($devid, $user, array $fields = null)
*/
public function saveSyncCache(array $cache, $devid, $user, array $dirty = array())
{
$cache['timestamp'] = strval($cache['timestamp']);
$this->_logger->info(
sprintf('[%s] Saving SYNC_CACHE entry fields %s for user %s and device %s.',
$this->_procid, serialize($dirty), $user, $devid));

$cache['timestamp'] = strval($cache['timestamp']);
$query = array(
'cache_devid' => $devid,
'cache_user' => $user
);
$update = array();

// Ensure the initial object is written for the collection data.
if (empty($cache['collections'])) {
$cache['collections'] = new stdClass();
$update['cache.data.collections'] = $cache['collections'];
}

$update = array();
foreach ($dirty as $property => $value) {
if ($property == 'collections' && is_array($value) && !empty($cache['collections'])) {
foreach (array_keys($value) as $collection) {
Expand Down

0 comments on commit 5a0e1d2

Please sign in to comment.