You are here

views_oai_pmh.module in Views OAI-PMH 6

File

views_oai_pmh.module
View source
<?php

define('OAI_TOKEN_LIFETIME', 24 * 3600);

/**
 * @file
 */
function views_oai_pmh_init() {

  // We have to include our theme preprocessors here until:
  // http://drupal.org/node/1096770 is fixed.
  module_load_include('inc', 'views_oai_pmh', 'theme/views_oai_pmh.theme');
}
function views_oai_pmh_views_api() {
  return array(
    'api' => 2,
  );
}
function views_oai_pmh_theme() {

  // Make sure that views picks up the preprocess functions.
  module_load_include('inc', 'views_oai_pmh', 'theme/views_oai_pmh.theme');
  return array(
    'oai_field_mapper_form' => array(
      'file' => 'theme/views_oai_pmh.theme.inc',
      'render element' => 'form',
    ),
  );
}
function views_oai_pmh_cron() {
  views_oai_pmh_garbage_collect();
}
function views_oai_pmh_garbage_collect() {
  $cache_flush = time() - OAI_TOKEN_LIFETIME;
  db_query("DELETE FROM {cache_views_oai_pmh} WHERE expire <= %d", $cache_flush);
}