summaryrefslogtreecommitdiff
path: root/modules/statistics.module
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2005-10-12 01:00:24 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2005-10-12 01:00:24 +0000
commit0953282878086c8c513344baa8f4daea66f19fd4 (patch)
tree61ebec9bf3fe15ca48db606be8aa5b6b47e3698c /modules/statistics.module
parent1b1a2d77509d93a560149de959a9f90f8d3aa74c (diff)
downloadbrdo-0953282878086c8c513344baa8f4daea66f19fd4.tar.gz
brdo-0953282878086c8c513344baa8f4daea66f19fd4.tar.bz2
- Statistics node view counter counted a lot of false positives (including a nid 0 for legacy URLs).
Diffstat (limited to 'modules/statistics.module')
-rw-r--r--modules/statistics.module4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/statistics.module b/modules/statistics.module
index ec5871ddf..fe9a12b3e 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -62,13 +62,13 @@ function statistics_exit() {
if (variable_get('statistics_count_content_views', 0)) {
// We are counting content views.
- if ((arg(0) == 'node') && arg(1)) {
+ if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') {
// 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(), arg(1));
// 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)', arg(1), time());
+ db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', arg(1), time());
}
}
}