diff options
Diffstat (limited to 'modules/statistics/statistics.module')
-rw-r--r-- | modules/statistics/statistics.module | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 06cb508ae..84ee28a3f 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -42,11 +42,11 @@ function statistics_exit() { // node view counters are enabled if ((arg(0) == "node") && (arg(1) == "view") && arg(2)) { // a node has been viewed, so updated the node's counters - db_query("UPDATE {statistics} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d", time(), arg(2)); + db_query("UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d", time(), arg(2)); // if we affected 0 rows, this is the first time viewing the node if (!db_affected_rows()) { // must create a new row to store counter's for new node - db_query("INSERT INTO {statistics} (nid, daycount, totalcount) VALUES(%d, 1, 1)", arg(2)); + db_query("INSERT INTO {node_counter} (nid, daycount, totalcount) VALUES(%d, 1, 1)", arg(2)); } } } @@ -326,7 +326,7 @@ function statistics_admin_topnodes_table() { array("data" => t("last hit"), "field" => "s.timestamp"), array("data" => t("operations")) ); - $sql = "SELECT s.nid, s.daycount, s.totalcount, s.timestamp, n.title FROM {statistics} s INNER JOIN {node} n ON s.nid = n.nid"; + $sql = "SELECT s.nid, s.daycount, s.totalcount, s.timestamp, n.title FROM {node_counter} s INNER JOIN {node} n ON s.nid = n.nid"; $sql .= tablesort_sql($header); $result = pager_query($sql, 20); // WHERE s.%s <> '0' @@ -611,7 +611,7 @@ function statistics_cron() { if ((time() - $statistics_timestamp) >= 86400) { /* reset day counts */ - db_query("UPDATE {statistics} SET daycount='0'"); + db_query("UPDATE {node_counter} SET daycount = '0'"); variable_set("statistics_day_timestamp", time()); } @@ -732,7 +732,7 @@ function statistics_display_online_block() { /* Display linked title based on field name */ function statistics_title_list($dbfield, $dbrows) { /* valid dbfields: totalcount, daycount, timestamp */ - return db_query_range("SELECT s.nid, n.title, u.uid, u.name FROM {statistics} s INNER JOIN {node} n ON s.nid = n.nid INNER JOIN {users} u ON n.uid = u.uid WHERE %s <> '0' AND n.status = 1 ORDER BY %s DESC", "s.". $dbfield, "s.". $dbfield, 0, $dbrows); + return db_query_range("SELECT s.nid, n.title, u.uid, u.name FROM {node_counter} s INNER JOIN {node} n ON s.nid = n.nid INNER JOIN {users} u ON n.uid = u.uid WHERE %s <> '0' AND n.status = 1 ORDER BY %s DESC", "s.". $dbfield, "s.". $dbfield, 0, $dbrows); } @@ -741,7 +741,7 @@ function statistics_get($nid) { if ($nid > 0) { /* retrieves an array with both totalcount and daycount */ - $statistics = db_fetch_array(db_query("SELECT totalcount, daycount, timestamp FROM {statistics} WHERE nid = %d", $nid)); + $statistics = db_fetch_array(db_query("SELECT totalcount, daycount, timestamp FROM {node_counter} WHERE nid = %d", $nid)); } return $statistics; @@ -832,7 +832,7 @@ function statistics_summary($dbfield, $dbrows) { /* valid dbfields: totalcount, daycount, timestamp */ $output = ""; - $result = db_query_range("SELECT n.nid, n.title FROM {statistics} s INNER JOIN {node} n ON s.nid = n.nid ORDER BY %s DESC", $dbfield, 0, $dbrows); + $result = db_query_range("SELECT n.nid, n.title FROM {node_counter} s INNER JOIN {node} n ON s.nid = n.nid ORDER BY %s DESC", $dbfield, 0, $dbrows); while ($nid = db_fetch_array($result)) { $content = node_load(array("nid" => $nid["nid"])); $links = link_node($content, 1); @@ -849,7 +849,7 @@ function statistics_nodeapi(&$node, $op, $arg = 0) { switch ($op) { case "delete": // clean up statistics table when node is deleted - db_query("DELETE FROM {statistics} WHERE nid = %d", $node->nid); + db_query("DELETE FROM {node_counter} WHERE nid = %d", $node->nid); } } |