save() 공개 메소드

Save the synccache to storage.
public save ( )
예제 #1
0
 public function testValidProperties()
 {
     $cache = new Horde_ActiveSync_SyncCache($this->_state, 'devid', 'userone');
     $cache->save();
     foreach (array('hbinterval', 'wait', 'hierarchy', 'confirmed_synckeys', 'lasthbsyncstarted', 'lastsyncendnormal', 'folders', 'pingheartbeat', 'timestamp') as $p) {
         $cache->{$p};
     }
 }
예제 #2
0
파일: Collections.php 프로젝트: horde/horde
 /**
  * Save the syncCache to storage.
  *
  * @param boolean $preserve_folders  If true, ensure the folder cache is not
  *                                   overwritten. @since 2.18.0
  * @todo Refactor this hack away. Requires a complete refactor of the cache.
  */
 public function save($preserve_folders = false)
 {
     // HOTFIX. Need to check the timestamp to see if we should reload the
     // folder cache before saving to ensure it isn't overwritten. See
     // Bug: 13273
     if ($preserve_folders && !$this->_cache->validateCache()) {
         $this->_logger->info(sprintf('[%s] Updating the foldercache before saving.', $this->_procid));
         $this->_cache->refreshFolderCache();
     }
     $this->_cache->save();
 }
예제 #3
0
파일: Mongo.php 프로젝트: jubinpatel/horde
 /**
  * Reset the sync state for this device, for the specified collection.
  *
  * @param string $id  The collection to reset.
  *
  * @return void
  * @throws Horde_ActiveSync_Exception
  */
 protected function _resetDeviceState($id)
 {
     $this->_logger->info(sprintf('[%s] Resetting device state for device: %s, user: %s, and collection: %s.', $this->_procid, $this->_deviceInfo->id, $this->_deviceInfo->user, $id));
     $query = array(self::SYNC_DEVID => $this->_deviceInfo->id, self::SYNC_FOLDERID => $id, self::SYNC_USER => $this->_deviceInfo->user);
     try {
         $this->_db->selectCollection(self::COLLECTION_STATE)->remove($query);
         $this->_db->selectCollection(self::COLLECTION_MAP)->remove($query);
         $this->_db->selectCollection(self::COLLECTION_MAILMAP)->remove($query);
     } catch (Exception $e) {
         $this->_logger->err($e->getMessage());
         throw new Horde_ActiveSync_Exception($e);
     }
     // Remove the collection data from the synccache as well.
     $cache = new Horde_ActiveSync_SyncCache($this, $this->_deviceInfo->id, $this->_deviceInfo->user, $this->_logger);
     if ($id != Horde_ActiveSync::REQUEST_TYPE_FOLDERSYNC) {
         $cache->removeCollection($id, false);
     } else {
         $this->_logger->notice(sprintf('[%s] Clearing foldersync state from synccache.', $this->_procid));
         $cache->clearFolders();
         $cache->clearCollections();
         $cache->hierarchy = '0';
     }
     $cache->save();
 }
예제 #4
0
파일: Sql.php 프로젝트: platolin/horde
 /**
  * Reset the sync state for this device, for the specified collection.
  *
  * @param string $id  The collection to reset.
  *
  * @return void
  * @throws Horde_ActiveSync_Exception
  */
 protected function _resetDeviceState($id)
 {
     $this->_logger->info(sprintf('[%s] Resetting device state for device: %s, user: %s, and collection: %s.', $this->_procid, $this->_deviceInfo->id, $this->_deviceInfo->user, $id));
     $state_query = 'DELETE FROM ' . $this->_syncStateTable . ' WHERE sync_devid = ? AND sync_folderid = ? AND sync_user = ?';
     $map_query = 'DELETE FROM ' . $this->_syncMapTable . ' WHERE sync_devid = ? AND sync_folderid = ? AND sync_user = ?';
     $mailmap_query = 'DELETE FROM ' . $this->_syncMailMapTable . ' WHERE sync_devid = ? AND sync_folderid = ? AND sync_user = ?';
     try {
         $this->_db->delete($state_query, array($this->_deviceInfo->id, $id, $this->_deviceInfo->user));
         $this->_db->delete($map_query, array($this->_deviceInfo->id, $id, $this->_deviceInfo->user));
         $this->_db->delete($mailmap_query, array($this->_deviceInfo->id, $id, $this->_deviceInfo->user));
     } catch (Horde_Db_Exception $e) {
         throw new Horde_ActiveSync_Exception($e);
     }
     // Remove the collection data from the synccache as well.
     $cache = new Horde_ActiveSync_SyncCache($this, $this->_deviceInfo->id, $this->_deviceInfo->user, $this->_logger);
     if ($id != Horde_ActiveSync::REQUEST_TYPE_FOLDERSYNC) {
         $cache->removeCollection($id, false);
     } else {
         $this->_logger->notice(sprintf('[%s] Clearing foldersync state from synccache.', $this->_procid));
         $cache->clearFolders();
         $cache->clearCollections();
         $cache->hierarchy = '0';
     }
     $cache->save();
 }
예제 #5
0
파일: Base.php 프로젝트: horde/horde
 /**
  * Tests initiating a partial sync where 1 collection was passed from
  * client and 2 others had to be loaded from cache.
  */
 protected function _testMissingCollections()
 {
     // Need to prime the cache with a synckey for contacts so we have
     // another one to load for the test.
     $col = array('id' => '@Contacts@', 'newsynckey' => '{517541cc-b188-478d-aaaa-fa49c0a8015f}35');
     $cache = new Horde_ActiveSync_SyncCache(self::$state, 'dev123', 'mike', self::$logger->getLogger());
     $cache->updateCollection($col, array('newsynckey' => true));
     $cache->save();
     $collections = $this->getCollectionHandler();
     $col = array('id' => '519422f1-4c5c-4547-946a-1701c0a8015f', 'windowsize' => 5, 'truncation' => 0, 'mimesupport' => 0, 'mimetruncation' => 8, 'conflict' => 1, 'bodyprefs' => array('wanted' => 2, 2 => array('type' => 2, 'truncationsize' => 300000)), 'synckey' => '{517541cc-b188-478d-9e1a-fa49c0a8015f}3', 'deletesasmoves' => 1, 'filtertype' => 5);
     $collections->addCollection($col);
     $collections->initPartialSync();
     $this->assertEquals(2, $collections->collectionCount());
 }