Author: Thomas Jarosch (thomas.jarosch@intra2net.com)
Author: Gunnar Wrobel (wrobel@pardus.de)
Example #1
0
 /**
  * Synchronize the preferences information with the information from the
  * backend.
  *
  * @param array $params Additional parameters.
  *
  * @return NULL
  */
 public function synchronize($params = array())
 {
     $this->_mapping = array();
     foreach ($this->_data->getObjects() as $id => $data) {
         $this->_mapping[$data['application']] = $id;
     }
     $this->_data_cache->setQuery(self::PREFS, $this->_mapping);
 }
Example #2
0
 /**
  * Perform a complete synchronization.
  *
  * @param Horde_Kolab_Storage_Folder_Stamp $stamp The current stamp.
  * @param array $params Additional parameters.
  *
  * @return NULL
  */
 private function _completeSynchronization(Horde_Kolab_Storage_Folder_Stamp $stamp, $params = array())
 {
     $this->_data_cache->reset();
     $ids = $stamp->ids();
     $params['last_sync'] = false;
     $params['changes'][Horde_Kolab_Storage_Folder_Stamp::ADDED] = empty($ids) ? array() : $this->fetch($ids);
     $this->_data_cache->store($params['changes'][Horde_Kolab_Storage_Folder_Stamp::ADDED], $stamp, $this->getVersion());
     $params['current_sync'] = $this->_data_cache->getLastSync();
     parent::synchronize($params);
     $this->_data_cache->save();
 }
Example #3
0
 /**
  * Perform a complete synchronization.
  *
  * @param Horde_Kolab_Storage_Folder_Stamp $stamp The current stamp.
  * @param array $params Additional parameters.
  *
  * @return NULL
  */
 private function _completeSynchronization(Horde_Kolab_Storage_Folder_Stamp $stamp, $params = array())
 {
     $this->_data_cache->reset();
     $ids = $stamp->ids();
     $params['last_sync'] = false;
     $params['changes'][Horde_Kolab_Storage_Folder_Stamp::ADDED] = empty($ids) ? array() : $this->fetch($ids);
     // logging
     $uids_to_log = array_keys($params['changes'][Horde_Kolab_Storage_Folder_Stamp::ADDED]);
     $this->_logger->debug(sprintf('[KOLAB_STORAGE] Full folder sync details: user: %s, folder: %s, uids: %s', $this->getAuth(), $this->getPath(), implode(', ', $uids_to_log)));
     $this->_data_cache->store($params['changes'][Horde_Kolab_Storage_Folder_Stamp::ADDED], $stamp, $this->getVersion());
     $params['current_sync'] = $this->_data_cache->getLastSync();
     parent::synchronize($params);
     $this->_data_cache->save();
 }
Example #4
0
 public function testLoadSave()
 {
     $cache = new Horde_Kolab_Storage_Cache(new Horde_Cache(new Horde_Cache_Storage_Mock()));
     $data_cache = new Horde_Kolab_Storage_Cache_Data($cache);
     $data_cache->setDataId('test');
     $data_cache->store(array('1000' => array('uid' => 'OBJECTID')), new Horde_Kolab_Storage_Folder_Stamp_Uids('a', 'b'), '1');
     $data_cache->save();
     $data_cache = new Horde_Kolab_Storage_Cache_Data($cache);
     $data_cache->setDataId('test');
     $data_cache->store(array('1001' => false), new Horde_Kolab_Storage_Folder_Stamp_Uids('a', 'c'), '1');
     $data_cache->save();
     $data_cache = new Horde_Kolab_Storage_Cache_Data($cache);
     $data_cache->setDataId('test');
     $this->assertEquals(array('OBJECTID' => array('uid' => 'OBJECTID')), $data_cache->getObjects());
 }