/** * Synchronize the preferences information with the information from the * backend. * * @param array $params Additional parameters. * * @return NULL */ public function synchronize($params = array()) { $stamp = $this->data->getStamp(); if (isset($params['changes'])) { foreach ($params['changes'][Horde_Kolab_Storage_Folder_Stamp::ADDED] as $bid => $object) { $this->_updateLog($object['uid'], $bid, $stamp); } foreach ($params['changes'][Horde_Kolab_Storage_Folder_Stamp::DELETED] as $bid => $object) { $this->history->log($object, array('action' => 'delete', 'bid' => $bid, 'stamp' => $stamp)); } } else { foreach ($this->data->getObjectToBackend() as $object => $bid) { $this->_updateLog($object, $bid, $stamp); } } }
/** * Perform a complete synchronization. * Also marks stale history entries as 'deleted'. * * @param string $prefix Horde_History prefix * @param boolean $is_reset Flag to indicate if the UIDVALIDITY changed */ protected function _completeSynchronization($prefix, $is_reset) { $seen_objects = array(); foreach ($this->_data->getObjectToBackend() as $object => $bid) { $full_id = $prefix . $object; $this->_updateLog($full_id, $bid, $is_reset); $seen_objects[$full_id] = true; } // cut off last ':' $search_prefix = substr($prefix, 0, -1); // clean up history database: Mark stale entries as deleted $all_entries = $this->_history->getByTimestamp('>', 0, array(), $search_prefix); foreach ($all_entries as $full_id => $db_id) { if (isset($seen_objects[$full_id])) { continue; } $last = $this->_history->getLatestEntry($full_id); if ($last === false || $last['action'] != 'delete') { $this->_logger->debug(sprintf('[KOLAB_STORAGE] Cleaning up already removed object from Horde_History: %s', $full_id)); $this->_history->log($full_id, array('action' => 'delete'), true); } } }
/** * Return the mapping of object IDs to backend IDs. * * @return array The object to backend mapping. */ public function getObjectToBackend() { return $this->_data->getObjectToBackend(); }