function ip_backlog_nodes in IP address manager 8.2
Same name and namespace in other branches
- 6 ip.module \ip_backlog_nodes()
- 7 ip.module \ip_backlog_nodes()
Handle backlog of nodes. @TODO port to D8.
File
- ./
ip.module, line 104 - IP address manager module.
Code
function ip_backlog_nodes() {
// This variable tracks the last wid.
$ip_backlog_nodes = variable_get('ip_backlog_nodes', PHP_INT_MAX);
if ($ip_backlog_nodes) {
$result = db_query_range("SELECT wid, hostname, link" . " FROM {watchdog}" . " WHERE type = 'content'" . " AND message = :msg" . " AND wid < :backlog_nodes" . " ORDER BY wid DESC", 0, 20, array(
':msg' => '@type: added %title.',
':backlog_nodes' => $ip_backlog_nodes,
));
$row_count = 0;
foreach ($result as $row) {
$nid = str_replace(array(
'<a href="' . base_path() . 'node/',
'">view</a>',
), array(
'',
'',
), $row->link);
// Test the node.
$node = node_load($nid);
if (!empty($node)) {
// ip_posts_insert('node', $nid, $row->hostname);
}
$row_count++;
variable_set('ip_backlog_nodes', $row->wid);
}
if (!$row_count) {
// Mark as finished.
variable_set('ip_backlog_nodes', 0);
}
}
}