You are here

function node_expire_cron in Node expire 6.2

Same name and namespace in other branches
  1. 8 node_expire.module \node_expire_cron()
  2. 5 node_expire.module \node_expire_cron()
  3. 6 node_expire.module \node_expire_cron()
  4. 7.2 node_expire.module \node_expire_cron()
  5. 7 node_expire.module \node_expire_cron()

Implementation of hook_cron().

File

./node_expire.module, line 14

Code

function node_expire_cron() {
  if ($query = db_query('SELECT n.nid FROM {node} n
      JOIN {node_expire} ne ON n.nid = ne.nid
      WHERE ne.expire <= %d', time())) {
    $nids = array();
    while ($node = db_fetch_object($query)) {
      $nids[] = $node->nid;
      node_expire_set_expired($node->nid);
      $node = node_load($node->nid);
      rules_invoke_event('node_expired', array(
        'node' => &$node,
      ));
    }
  }
}