protected function views_oai_pmh_plugin_style::load_resumption_token_and_resume_query in Views OAI-PMH 7.3
Load the resumption token and resume query.
2 calls to views_oai_pmh_plugin_style::load_resumption_token_and_resume_query()
- views_oai_pmh_plugin_style::list_identifiers_query in plugins/
views_oai_pmh_plugin_style.inc - Prepares the query for a 'ListIdentifiers' OAI-PMH request.
- views_oai_pmh_plugin_style::list_records_query in plugins/
views_oai_pmh_plugin_style.inc - Prepares the query for a 'ListRecords' OAI-PMH request.
File
- plugins/
views_oai_pmh_plugin_style.inc, line 285 - Contains the base OAI-PMH style plugin.
Class
- views_oai_pmh_plugin_style
- Views OAI-PMH_plugin style.
Code
protected function load_resumption_token_and_resume_query() {
$cache = db_select('cache_views_oai_pmh', 'c')
->fields('c')
->condition('cid', $this->request->resumption_token, '=')
->condition('expire', time() - VIEWS_OAI_PMH_TOKEN_LIFETIME, '>')
->execute()
->fetchObject();
if (isset($cache->data)) {
$cache->data = unserialize($cache->data);
if (is_array($cache->data) && $cache->data['verb'] == $this->request->verb) {
$this->view->query = $cache->data['query'];
// Offset the query.
$this->view->query->pager
->set_current_page($cache->data['current_page'] + 1);
// Restore some of the request data.
$this->request->metadata_format = views_oai_pmh_get_metadata_format($cache->data['metadata_format']);
return;
}
}
$this->request->errors[] = new views_oai_pmh_error_bad_resumption_token($this->request->resumption_token);
}