/** * Constructor. * * @param array $params Configuration parameters: * <ul> * <li> * REQUIRED parameters: * <ul> * <li> * mongo_db: (Horde_Mongo_Client) A MongoDB client object. * </li> * </ul> * </li> */ public function __construct($auth, array $params = array()) { if (!isset($params['mongo_db'])) { throw new InvalidArgumentException('Missing mongo_db parameter.'); } parent::__construct($params); $this->_db = $params['mongo_db']->selectDB(null); }
/** * Constructor. * * @param array $params Configuration parameters: * <pre> * REQUIRED parameters: * - drivers: (array) An array of Horde_History objects. * </pre> */ public function __construct($auth, array $params = array()) { if (!isset($params['drivers'])) { throw new InvalidArgumentException('Missing drivers parameter.'); } $this->_drivers = $params['drivers']; parent::__construct($params); }
/** */ 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; }
/** * Resets the bad login counter. * * @param string $userId The user to reset. * * @throws Horde_Auth_Exception */ protected function _resetBadLogins($userId) { if (!$this->_history_api) { throw new Horde_Auth_Exception('Unsupported.'); } try { $this->_history_api->removeByNames(array($userId . '@logins.failed')); } catch (Horde_History_Exception $e) { throw new Horde_Auth_Exception($e); } }
/** * Update the history log for an object. * * @param string $object The object ID. * @param string $bid The backend ID of * the object. * @param Horde_Kolab_Storage_Folder_Stamp $stamp The folder stamp. * * @return NULL */ private function _updateLog($object, $bid, $stamp) { $log = $this->history->getHistory($object); if (count($log) == 0) { $this->history->log($object, array('action' => 'add', 'bid' => $bid, 'stamp' => $stamp)); } else { $last = array('ts' => 0); foreach ($log as $entry) { if ($entry['ts'] > $last['ts']) { $last = $entry; } } if (!isset($last['bid']) || $last['bid'] != $bid || isset($last['stamp']) && $last['stamp']->isReset($stamp)) { $this->history->log($object, array('action' => 'modify', 'bid' => $bid, 'stamp' => $stamp)); } } }
/** * Update the history log for an object. * * @param string $object The object ID. * @param string $bid The backend ID of the object. * @param boolean $force Force update */ protected function _updateLog($object, $bid, $force = false) { $last = $this->_history->getLatestEntry($object); if ($last === false) { // New, unknown object $this->_logger->debug(sprintf('[KOLAB_STORAGE] New object to log in Horde_History: %s, uid: %d', $object, $bid)); $this->_history->log($object, array('action' => 'add', 'bid' => $bid), true); } else { // If the last action for this object was 'delete', we issue an 'add'. // Objects can vanish and re-appear using the same object uid. // (a foreign client is sending an update over a slow link) if ($last['action'] == 'delete') { $this->_logger->debug(sprintf('[KOLAB_STORAGE] Re-adding previously deleted object in Horde_History: %s, uid: %d', $object, $bid)); $this->_history->log($object, array('action' => 'add', 'bid' => $bid), true); } if (!isset($last['bid']) || $last['bid'] != $bid || $force) { $this->_logger->debug(sprintf('[KOLAB_STORAGE] Modifying object in Horde_History: %s, uid: %d, force: %d', $object, $bid, $force)); $this->_history->log($object, array('action' => 'modify', 'bid' => $bid), true); } } }
/** * Return the maximum modification sequence. To be overridden in concrete * class. * * @param string $parent Restrict to entries a specific parent. * * @return integer The modseq */ public function getHighestModSeq($parent = null) { return $this->_history->getHighestModSeq($parent); }
/** * Constructor. * * @param string $auth The current user. * @param Horde_Db_Adapter $db The database connection. */ public function __construct($auth, Horde_Db_Adapter $db) { parent::__construct($auth); $this->_db = $db; }