/** * get array of ids which got send to the client for a given class * * @param ActiveSync_Model_Device $_deviceId * @param string $_class * @return array */ public function getClientState(ActiveSync_Model_Device $_deviceId, $_class, $_collectionId) { # contentid $select = $this->_getSelect('contentid'); $select->where($this->_db->quoteIdentifier('device_id') . ' = ?', $_deviceId->getId())->where($this->_db->quoteIdentifier('class') . ' = ?', $_class)->where($this->_db->quoteIdentifier('collectionid') . ' = ?', $_collectionId); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(Zend_Db::FETCH_COLUMN); return $result; }
/** * update sync key * * @param ActiveSync_Model_Device $_device * @param Tinebase_DateTime $_counter * @param $_timeStamp * @param $_class * @param $_collectionId * @deprecated * @return void */ public function updateSyncKey(ActiveSync_Model_Device $_device, $_counter, Tinebase_DateTime $_timeStamp, $_class, $_collectionId = NULL, $_keepPreviousSyncKey = true) { $type = $_collectionId !== NULL ? $_class . '-' . $_collectionId : $_class; if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' update synckey to ' . $_counter . ' for type: ' . $type); } $newSyncState = new ActiveSync_Model_SyncState(array('device_id' => $_device->getId(), 'counter' => $_counter, 'type' => $type, 'lastsync' => $_timeStamp->get(Tinebase_Record_Abstract::ISO8601LONG))); try { // check if we need to update synckey timestamps $this->_syncStateBackend->get($newSyncState); $this->_syncStateBackend->update($newSyncState); } catch (ActiveSync_Exception_SyncStateNotFound $asessnf) { // otherwise add new synckey $this->_syncStateBackend->create($newSyncState); } if ($_keepPreviousSyncKey !== true) { // remove all other synckeys $this->_syncStateBackend->deleteOther($newSyncState); } return $newSyncState; }