summaryrefslogtreecommitdiff
path: root/modules/statistics.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-10-22 20:20:35 +0000
committerDries Buytaert <dries@buytaert.net>2003-10-22 20:20:35 +0000
commit72ae2d39953125a231592d2a2b7ad14afe35b1bd (patch)
tree1b261d628460a8db3775d6d83c1f928d2726ce1d /modules/statistics.module
parent742410aafdf3d85ec3f0060e5c9fd1d09ee71672 (diff)
downloadbrdo-72ae2d39953125a231592d2a2b7ad14afe35b1bd.tar.gz
brdo-72ae2d39953125a231592d2a2b7ad14afe35b1bd.tar.bz2
- Bugfix: renamed the 'statistics' table to 'node_counter' as 'statistics' is
a reserved SQL keyword. Required for both PostgreSQL and MSSQL. Patch by Adrian. - Bugfix: renamed the 'path' table to 'url_alias' as 'path' is a reserved SQL keyword. Required for both PostgreSQL and MSSQL. Patch by Adrian.
Diffstat (limited to 'modules/statistics.module')
-rw-r--r--modules/statistics.module16
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/statistics.module b/modules/statistics.module
index 06cb508ae..84ee28a3f 100644
--- a/modules/statistics.module
+++ b/modules/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);
}
}