You are here

function path_redirect_cron in Path redirect 6

Implements hook_cron().

File

./path_redirect.module, line 150

Code

function path_redirect_cron() {

  // Purge inactive redirects from the database.
  if ($purge = variable_get('path_redirect_purge_inactive', 0)) {
    $query = db_query("SELECT rid FROM {path_redirect} WHERE last_used < %d", time() - $purge);
    $rids = array();
    while ($rid = db_result($query)) {
      $rids[] = $rid;
    }
    if ($rids) {
      path_redirect_delete_multiple($rids);
      watchdog('path_redirect', format_plural(count($rids), 'Removed 1 inactive redirect from the database.', 'Removed @count inactive redirects from the database.'));
    }
  }
}