Finds history objects by timestamp, and optionally filter on other
fields as well.
public getByTimestamp ( string $cmp, integer $ts, array $filters = [], string $parent = null ) : array | ||
$cmp | string | The comparison operator (<, >, <=, >=, or =) to check the timestamps with. |
$ts | integer | The timestamp to compare against. |
$filters | array | An array of additional (ANDed) criteria. Each array value should be an array with 3 entries: - field: the history field being compared (i.e. 'action'). - op: the operator to compare this field with. - value: the value to check for (i.e. 'add'). |
$parent | string | The parent history to start searching at. If non-empty, will be searched for with a LIKE '$parent:%' clause. |
리턴 | array | An array of history object ids, or an empty array if none matched the criteria. |
/** */ public function getChanges($ts) { $msgids = preg_replace('/^([^:]*:){2}/', '', array_keys($this->_history->getByTimestamp('>', $ts, array(), $this->_getUniqueHistoryId()))); $out = array(); foreach ($msgids as $val) { $out[] = new IMP_Maillog_Message($val); } return $out; }
/** * Perform a complete synchronization. * Also marks stale history entries as 'deleted'. * * @param string $prefix Horde_History prefix * @param boolean $is_reset Flag to indicate if the UIDVALIDITY changed */ protected function _completeSynchronization($prefix, $is_reset) { $seen_objects = array(); foreach ($this->_data->getObjectToBackend() as $object => $bid) { $full_id = $prefix . $object; $this->_updateLog($full_id, $bid, $is_reset); $seen_objects[$full_id] = true; } // cut off last ':' $search_prefix = substr($prefix, 0, -1); // clean up history database: Mark stale entries as deleted $all_entries = $this->_history->getByTimestamp('>', 0, array(), $search_prefix); foreach ($all_entries as $full_id => $db_id) { if (isset($seen_objects[$full_id])) { continue; } $last = $this->_history->getLatestEntry($full_id); if ($last === false || $last['action'] != 'delete') { $this->_logger->debug(sprintf('[KOLAB_STORAGE] Cleaning up already removed object from Horde_History: %s', $full_id)); $this->_history->log($full_id, array('action' => 'delete'), true); } } }
/** * @see Horde_History::getByTimestamp() */ public function getByTimestamp($cmp, $ts, array $filters = array(), $parent = null) { return $this->_history->getByTimestamp($cmp, $ts, $filters, $parent); }