function _node_expire_propagate_new in Node expire 5
Recursion for inheritance.
1 call to _node_expire_propagate_new()
- node_expire_nodeapi in ./
node_expire.module - Prepare and parse the data from our node entry forms.
File
- ./
node_expire.module, line 987 - Alerts administrators of possibly outdated materials and optionally unpublishes them.
Code
function _node_expire_propagate_new($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 ' . 'COALESCE(b.isroot, 0) = 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->expiration_type == 'onupdate') {
$changed = date('Y-m-d H:i:s', strtotime($node->expire_timefrom, $changed));
}
else {
$changed = $node->expire;
}
// 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, expiresec, expiremode, isroot) VALUES (%d, '%s', '%s', '%s', 0)", $nid, $changed, $node->expire_timefrom, $node->expiration_type);
return true;
}