/** * 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(); }
/** * 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(); }