summaryrefslogtreecommitdiff
path: root/modules/statistics
diff options
context:
space:
mode:
Diffstat (limited to 'modules/statistics')
-rw-r--r--modules/statistics/statistics.module48
1 files changed, 24 insertions, 24 deletions
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 3e7a6c10b..e864fab26 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -27,7 +27,7 @@ function statistics_init() {
if ($throttle < 5) {
$multiplier = variable_get("statistics_throttle_multiplier", 60);
// count all hits in past sixty seconds
- $result = db_query("SELECT COUNT(timestamp) AS hits FROM accesslog WHERE timestamp >= %d", (time() - 60));
+ $result = db_query("SELECT COUNT(timestamp) AS hits FROM {accesslog} WHERE timestamp >= %d", (time() - 60));
$recent_activity = db_fetch_array($result);
throttle_update($recent_activity["hits"]);
}
@@ -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 {statistics} 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 {statistics} (nid, daycount, totalcount) VALUES(%d, 1, 1)", arg(2));
}
}
}
@@ -57,10 +57,10 @@ function statistics_exit() {
$hostname = getenv("REMOTE_ADDR");
// log this page access
if ((arg(0) == "node") && (arg(1) == "view") && arg(2)) {
- db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values(%d, '%s', '%s', %d, %d)", arg(2), $referrer, $hostname, $user->uid, time());
+ db_query("INSERT INTO {accesslog} (nid, url, hostname, uid, timestamp) values(%d, '%s', '%s', %d, %d)", arg(2), $referrer, $hostname, $user->uid, time());
}
else {
- db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', %d, %d)", $referrer, $hostname, $user->uid, time());
+ db_query("INSERT INTO {accesslog} (url, hostname, uid, timestamp) values('%s', '%s', %d, %d)", $referrer, $hostname, $user->uid, time());
}
}
}
@@ -261,7 +261,7 @@ function statistics_admin() {
/* Displays the various admin tables */
function statistics_admin_count_table($dbfield, $dbrows) {
- $result = db_query_range("SELECT s.nid, s.daycount, s.totalcount, s.timestamp, n.title FROM statistics s LEFT JOIN node n USING (nid) WHERE s.%s <> '0' ORDER BY s.%s DESC", $dbfield, $dbfield, 0, $dbrows);
+ $result = db_query_range("SELECT s.nid, s.daycount, s.totalcount, s.timestamp, n.title FROM {statistics} s LEFT JOIN {node} n USING (nid) WHERE s.%s <> '0' ORDER BY s.%s DESC", $dbfield, $dbfield, 0, $dbrows);
$header = array(t("title"), t("today"), t("all time"), t("last hit"), t("operations"));
@@ -279,24 +279,24 @@ function statistics_admin_accesslog_table($type, $id) {
/* retrieve user access logs */
if ($id) {
/* retrieve recent access logs for user $id */
- $result = pager_query("SELECT nid, url, hostname, uid, timestamp FROM accesslog WHERE uid = '". check_query($id) ."' ORDER BY timestamp DESC", 50);
+ $result = pager_query("SELECT nid, url, hostname, uid, timestamp FROM {accesslog} WHERE uid = '". check_query($id) ."' ORDER BY timestamp DESC", 50);
}
else {
/* retrieve recent access logs for all users */
- $result = pager_query("SELECT nid, url, hostname, uid, MAX(timestamp) AS timestamp FROM accesslog WHERE uid <> '0' GROUP BY uid, nid, url, hostname ORDER BY timestamp DESC", 50);
+ $result = pager_query("SELECT nid, url, hostname, uid, MAX(timestamp) AS timestamp FROM {accesslog} WHERE uid <> '0' GROUP BY uid, nid, url, hostname ORDER BY timestamp DESC", 50);
}
}
else if ($type == 2) {
/* retrieve recent access logs for node $id */
- $result = pager_query("SELECT nid, url, hostname, uid, timestamp FROM accesslog WHERE nid = '". check_query($id) ."' ORDER BY timestamp DESC", 50);
+ $result = pager_query("SELECT nid, url, hostname, uid, timestamp FROM {accesslog} WHERE nid = '". check_query($id) ."' ORDER BY timestamp DESC", 50);
}
else if ($type == 3) {
/* retrieve recent access logs for hostname $id */
- $result = pager_query("SELECT nid, url, hostname, uid, timestamp FROM accesslog WHERE hostname = '". check_query($id) ."' ORDER BY timestamp DESC", 50);
+ $result = pager_query("SELECT nid, url, hostname, uid, timestamp FROM {accesslog} WHERE hostname = '". check_query($id) ."' ORDER BY timestamp DESC", 50);
}
else {
/* retrieve all recent access logs */
- $result = pager_query("SELECT nid, url, hostname, uid, timestamp FROM accesslog ORDER BY timestamp DESC", 50);
+ $result = pager_query("SELECT nid, url, hostname, uid, timestamp FROM {accesslog} ORDER BY timestamp DESC", 50);
}
$header = array(t("timestamp"), t("post"), t("user"), t("hostname"), t("referrer"), array("data" => t("operations"), "colspan" => "3"));
@@ -330,14 +330,14 @@ function statistics_recent_refer() {
$view = arg(3);
if ($view == "all") {
- $query = "SELECT url,timestamp FROM accesslog WHERE url <> '' ORDER BY timestamp DESC";
+ $query = "SELECT url,timestamp FROM {accesslog} WHERE url <> '' ORDER BY timestamp DESC";
}
elseif ($view == "internal") {
- $query = "SELECT url,timestamp FROM accesslog WHERE url LIKE '%". check_query($_SERVER["HTTP_HOST"]) ."%' ORDER BY timestamp DESC";
+ $query = "SELECT url,timestamp FROM {accesslog} WHERE url LIKE '%". check_query($_SERVER["HTTP_HOST"]) ."%' ORDER BY timestamp DESC";
$describe = "internal ";
}
else {
- $query = "SELECT url,timestamp FROM accesslog WHERE url NOT LIKE '%". check_query($_SERVER["HTTP_HOST"]) ."%' AND url <> '' ORDER BY timestamp DESC";
+ $query = "SELECT url,timestamp FROM {accesslog} WHERE url NOT LIKE '%". check_query($_SERVER["HTTP_HOST"]) ."%' AND url <> '' ORDER BY timestamp DESC";
$describe = "external ";
}
@@ -360,15 +360,15 @@ function statistics_top_refer() {
$view = arg(3);
if ($view == "all") {
- $query = "SELECT url, COUNT(url) AS count FROM accesslog WHERE url <> '' GROUP BY url ORDER BY count DESC";
+ $query = "SELECT url, COUNT(url) AS count FROM {accesslog} WHERE url <> '' GROUP BY url ORDER BY count DESC";
}
elseif ($view == "internal") {
- $query = "SELECT url, COUNT(url) AS count FROM accesslog WHERE url LIKE '%". check_query($_SERVER["HTTP_HOST"]) ."%' GROUP BY url ORDER BY count DESC";
+ $query = "SELECT url, COUNT(url) AS count FROM {accesslog} WHERE url LIKE '%". check_query($_SERVER["HTTP_HOST"]) ."%' GROUP BY url ORDER BY count DESC";
$describe = "internal ";
}
else {
/* default to external */
- $query = "SELECT url, COUNT(url) AS count FROM accesslog WHERE url NOT LIKE '%". check_query($_SERVER["HTTP_HOST"]) ."%' AND url <> '' GROUP BY url ORDER BY count DESC";
+ $query = "SELECT url, COUNT(url) AS count FROM {accesslog} WHERE url NOT LIKE '%". check_query($_SERVER["HTTP_HOST"]) ."%' AND url <> '' GROUP BY url ORDER BY count DESC";
$describe = "external ";
}
@@ -565,12 +565,12 @@ function statistics_cron() {
if ((time() - $statistics_timestamp) >= 86400) {
/* reset day counts */
- db_query("UPDATE statistics SET daycount='0'");
+ db_query("UPDATE {statistics} SET daycount='0'");
variable_set("statistics_day_timestamp", time());
}
/* clean expired access logs */
- db_query("DELETE FROM accesslog WHERE ". time() ." - timestamp > ". variable_get("statistics_flush_accesslog_timer", 259200));
+ db_query("DELETE FROM {accesslog} WHERE ". time() ." - timestamp > ". variable_get("statistics_flush_accesslog_timer", 259200));
$throttle = variable_get("statistics_throttle_level", 0);
/* check if throttle is currently on and if it's time to drop level */
@@ -626,7 +626,7 @@ function statistics_display_online_block() {
** This call gathers all the info we need on users/guests in a single
** database call, thus is quite efficient.
*/
- $result = db_query("SELECT COUNT(DISTINCT hostname) AS count, uid, MAX(timestamp) AS max_timestamp FROM accesslog WHERE timestamp >= %d GROUP BY uid ORDER BY max_timestamp DESC", (time() - $time_period));
+ $result = db_query("SELECT COUNT(DISTINCT hostname) AS count, uid, MAX(timestamp) AS max_timestamp FROM {accesslog} WHERE timestamp >= %d GROUP BY uid ORDER BY max_timestamp DESC", (time() - $time_period));
$users = $guests = 0;
/* Count number of users & guests currently online based on db query */
@@ -682,7 +682,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 LEFT JOIN node n ON s.nid = n.nid LEFT 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 {statistics} s LEFT JOIN {node} n ON s.nid = n.nid LEFT 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);
}
@@ -691,7 +691,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 {statistics} WHERE nid = %d", $nid));
}
return $statistics;
@@ -782,7 +782,7 @@ function statistics_summary($dbfield, $dbrows) {
/* valid dbfields: totalcount, daycount, timestamp */
$output = "";
- $result = db_query_range("SELECT n.nid, n.title FROM statistics s LEFT 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 {statistics} s LEFT 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);
@@ -799,7 +799,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 {statistics} WHERE nid = %d", $node->nid);
}
}