function boost_stats_update_node_counter in Boost 6
Same name in this branch
- 6 stats/boost_stats.ajax.inc \boost_stats_update_node_counter()
- 6 stats/boost_stats.php \boost_stats_update_node_counter()
Update database node count.
Parameters
$nid: Node ID of page.
2 calls to boost_stats_update_node_counter()
- boost_stats.php in stats/
boost_stats.php - Place in webroot, for faster stats if needed.
- boost_stats_ajax_callback in stats/
boost_stats.ajax.inc - AJAX Menu Callback.
File
- stats/
boost_stats.ajax.inc, line 86 - Boost & core stats logic
Code
function boost_stats_update_node_counter($nid) {
// A node has been viewed, so update the node's counters.
db_query('UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d', time(), $nid);
// If we affected 0 rows, this is the first time viewing the node.
if (!db_affected_rows()) {
// We must create a new row to store counters for the new node.
db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', $nid, time());
}
}