You are here

function oauth_common_cron in OAuth 1.0 7.4

Same name and namespace in other branches
  1. 6.3 oauth_common.module \oauth_common_cron()
  2. 7.3 oauth_common.module \oauth_common_cron()

Implements hook_cron().

File

./oauth_common.module, line 185

Code

function oauth_common_cron() {
  $token_condition = db_and()
    ->condition('expires', 0, '<>')
    ->condition('expires', REQUEST_TIME, '<=');
  db_delete('oauth_common_provider_token')
    ->condition('tid', db_select('oauth_common_token', 't')
    ->condition($token_condition)
    ->fields('t', array(
    'tid',
  )), 'IN')
    ->execute();
  db_delete('oauth_common_token')
    ->condition($token_condition)
    ->execute();

  // Should 300 be overriden in DrupalOAuthServer and made configurable?
  db_delete('oauth_common_nonce')
    ->condition('timestamp', REQUEST_TIME - 300, '<')
    ->execute();
}