/** * Return the SyncStamp - the value used to determine the end of the current * sync range. If the collection backend supports modification sequences, * we will use that, otherwise return the current timestamp. * * @param string $collection The collection id we are currently requesting. * @param integer $last The last syncstamp, if known. Used to help * sanity check the state. * * @return integer|boolean The SyncStamp or false if an error is encountered. * @since 2.6.0 */ public function getSyncStamp($collection, $last = null) { $this->_logger->info(sprintf('[%s] Horde_Core_ActiveSync_Driver::getSyncStamp(%s, %d);', getmypid(), $collection, $last)); // For FolderSync (empty $collection) or Email collections, we don't care. if (empty($collection)) { return time(); } $parts = $this->_parseFolderId($collection); if (is_array($parts)) { $class = $parts[self::FOLDER_PART_CLASS]; $id = $parts[self::FOLDER_PART_ID]; } else { $class = $parts; $id = null; } if (!in_array($class, array(Horde_ActiveSync::CLASS_CALENDAR, Horde_ActiveSync::CLASS_NOTES, Horde_ActiveSync::CLASS_CONTACTS, Horde_ActiveSync::CLASS_TASKS))) { return time(); } if ($this->_connector->hasFeature('modseq', $this->_classMap[$class])) { $modseq = $this->_connector->getHighestModSeq($this->_classMap[$class], $id); // Sanity check - if the last syncstamp is higher then the // current modification sequence, something is wrong. Could be // the history backend just happend to have deleted the most recent // entry or (more likely) we are transitioning from using // timestamps to using sequences. In this case the difference would // be VERY large, so try to detect that. if (!empty($last) && $last > $modseq && $last - $modseq > 1000000000) { return false; } return intval($modseq); } return time(); }