diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-12-26 14:23:38 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-12-26 14:23:38 +0000 |
commit | 0d100b57dcffe54ec7f46d8f577a4c26fcf34202 (patch) | |
tree | ffcfb6c4cb5e1f9481479620c87b37a2c7b6ebec /modules/statistics/statistics.module | |
parent | fc063806de3ded56d1c3d78a49e8a60de7a7fe1c (diff) | |
download | brdo-0d100b57dcffe54ec7f46d8f577a4c26fcf34202.tar.gz brdo-0d100b57dcffe54ec7f46d8f577a4c26fcf34202.tar.bz2 |
- Patch #332002 by Crell et al: MergeQuery should refuse to execute if there are no key fields. With tests.
Diffstat (limited to 'modules/statistics/statistics.module')
-rw-r--r-- | modules/statistics/statistics.module | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index d90c257d2..8cb1cc6e2 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -51,14 +51,13 @@ function statistics_exit() { // We are counting content views. if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') { // A node has been viewed, so update the node's counters. - $fields = array( - 'daycount' => 1, - 'totalcount' => 1, - 'nid' => arg(1), - 'timestamp' => REQUEST_TIME, - ); db_merge('node_counter') - ->fields($fields) + ->key(array('nid' => arg(1))) + ->fields(array( + 'daycount' => 1, + 'totalcount' => 1, + 'timestamp' => REQUEST_TIME, + )) ->expression('daycount', 'daycount + 1') ->expression('totalcount', 'totalcount + 1') ->execute(); |