/** * Deletes the rows for expired tokens from the table. */ public function purgeExpiredTokens() { $db = $this->getDb(); $db->delete($this->getTableName(), 'expiration <= ' . $db->quote(OaiPmhRepository_Date::unixToDb(time()))); }
/** * Stores a new resumption token record in the database * * @param string $verb OAI-PMH verb for the request * @param string $metadataPrefix Metadata prefix * @param int $cursor Offset in response to begin output at * @param mixed $set Optional set argument * @param string $from Optional from date argument * @param string $until Optional until date argument * @return OaiPmhRepositoryToken Token model object */ private function createResumptionToken($verb, $metadataPrefix, $cursor, $set, $from, $until) { $tokenTable = get_db()->getTable('OaiPmhRepositoryToken'); $resumptionToken = new OaiPmhRepositoryToken(); $resumptionToken->verb = $verb; $resumptionToken->metadata_prefix = $metadataPrefix; $resumptionToken->cursor = $cursor; if ($set) { $resumptionToken->set = $set; } if ($from) { $resumptionToken->from = $from; } if ($until) { $resumptionToken->until = $until; } $resumptionToken->expiration = OaiPmhRepository_Date::unixToDb(time() + $this->_tokenExpirationTime * 60); $resumptionToken->save(); return $resumptionToken; }