function _node_expire_propagate_book in Node expire 6
Recursion for inheritance.
1 call to _node_expire_propagate_book()
- node_expire_nodeapi in ./
node_expire.module - Prepare and parse the data from our node entry forms.
File
- ./
node_expire.book.inc, line 12 - Special functions for book contents. Since its a specific code, it doesnt need to be loaded everytime.
Code
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);
}