You are here

node_expire.book.inc in Node expire 6

Special functions for book contents. Since its a specific code, it doesnt need to be loaded everytime.

File

node_expire.book.inc
View source
<?php

/**
 * @file
 * Special functions for book contents. Since its a specific code, it
 * doesnt need to be loaded everytime.
 */

/**
 * Recursion for inheritance.
 */
function _node_expire_propagate_book($nid, $changed, $node) {

  // Get a list of all the children
  $query = db_query('SELECT a.nid, c.changed
    FROM {book} a
    LEFT JOIN {node_expire} b ON a.nid = b.nid
    LEFT JOIN {node} c ON a.nid = c.nid
    WHERE a.parent = %d AND b.isroot = 0', $nid);
  while ($row = db_fetch_object($query)) {
    _node_expire_propagate_new($row->nid, $row->changed, $node);
  }

  // Update the expiration time according to last update of the node itself
  if ($node->expiremode == NODE_EXPIRE_ONUPDATE) {
    $node->expire = strtotime($node->expire_timefrom);
  }

  // To keep track of inheritances and other such things, every node records its expiration settings, not just ones set to expire.
  db_query('DELETE FROM {node_expire} WHERE nid = %d', $nid);
  db_query("INSERT INTO {node_expire} (nid, expire, expire_timefrom, expiremode, isroot)\n    VALUES (%d, %d, '%s', %d, 0)", $nid, $node->expire, $node->expire_timefrom, $node->expiremode);
}

Functions

Namesort descending Description
_node_expire_propagate_book Recursion for inheritance.