diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-11-26 19:39:07 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-11-26 19:39:07 +0000 |
commit | 8fa5440bb4c01e647301422d9bf83f9f6eda8978 (patch) | |
tree | ea34ac9280bf8bc176be53816ee6cf1aab909125 /modules | |
parent | 51778ef1b34d985c5f3eeb5a3236218f01799d4f (diff) | |
download | brdo-8fa5440bb4c01e647301422d9bf83f9f6eda8978.tar.gz brdo-8fa5440bb4c01e647301422d9bf83f9f6eda8978.tar.bz2 |
- Applied Jeremy's statistics module patches:
+ Fixed "recent users" title/timestamps.
+ Added statistics_node_delete() function.
- Applied Jeremy's node module patches:
+ Added call to statistics_node_delete().
+ Fixed call to taxonomy_node_delete().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/node.module | 12 | ||||
-rw-r--r-- | modules/node/node.module | 12 | ||||
-rw-r--r-- | modules/statistics.module | 9 | ||||
-rw-r--r-- | modules/statistics/statistics.module | 9 |
4 files changed, 30 insertions, 12 deletions
diff --git a/modules/node.module b/modules/node.module index f086eaa0e..b9f751ec1 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1235,9 +1235,13 @@ function node_delete($edit) { ** Delete any taxonomy terms */ - if (function_exists("taxonomy_node_delete")) { - taxonomy_node_delete($nid, $node->taxonomy); - } + module_invoke("taxonomy", "node_delete", $node->nid); + + /* + ** Delete related node statistics + */ + + module_invoke("statistics", "node_delete", $node->nid); /* ** Call the node specific callback (if any): @@ -1325,7 +1329,7 @@ function node_page() { } else if ($and) { // this is an AND - $result = db_query_pager("SELECT n.nid, type, count(*) AS c FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND ". ($id ? "nid = '$id' AND " : "") ."status = '1' GROUP BY n.nid HAVING c = ".count($terms)." ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); + $result = db_query_pager("SELECT n.nid, n.type FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND ". ($id ? "nid = '$id' AND " : "") ."status = '1' GROUP BY n.nid, n.type, n.status, n.static, n.created HAVING COUNT(n.nid) = ".count($terms)." ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); } else { $result = db_query_pager("SELECT nid, type FROM node WHERE ". ($id ? "nid = '$id'" : "promote = '1'") ." AND status = '1' ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); diff --git a/modules/node/node.module b/modules/node/node.module index f086eaa0e..b9f751ec1 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1235,9 +1235,13 @@ function node_delete($edit) { ** Delete any taxonomy terms */ - if (function_exists("taxonomy_node_delete")) { - taxonomy_node_delete($nid, $node->taxonomy); - } + module_invoke("taxonomy", "node_delete", $node->nid); + + /* + ** Delete related node statistics + */ + + module_invoke("statistics", "node_delete", $node->nid); /* ** Call the node specific callback (if any): @@ -1325,7 +1329,7 @@ function node_page() { } else if ($and) { // this is an AND - $result = db_query_pager("SELECT n.nid, type, count(*) AS c FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND ". ($id ? "nid = '$id' AND " : "") ."status = '1' GROUP BY n.nid HAVING c = ".count($terms)." ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); + $result = db_query_pager("SELECT n.nid, n.type FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND ". ($id ? "nid = '$id' AND " : "") ."status = '1' GROUP BY n.nid, n.type, n.status, n.static, n.created HAVING COUNT(n.nid) = ".count($terms)." ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); } else { $result = db_query_pager("SELECT nid, type FROM node WHERE ". ($id ? "nid = '$id'" : "promote = '1'") ." AND status = '1' ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); diff --git a/modules/statistics.module b/modules/statistics.module index b085f2b3d..8fbdfe0e7 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -341,7 +341,7 @@ function statistics_admin_accesslog_table($type, $id) { } else { /* retrieve recent access logs for all users */ - $result = db_query("SELECT nid, url, hostname, uid, MAX(timestamp) AS max_timestamp FROM accesslog WHERE uid <> '0' GROUP BY uid ORDER BY max_timestamp DESC LIMIT %s", $limit1); + $result = db_query("SELECT nid, url, hostname, uid, MAX(timestamp) AS timestamp FROM accesslog WHERE uid <> '0' GROUP BY uid ORDER BY timestamp DESC LIMIT %s", $limit1); } } else if ($type == 2) { @@ -533,7 +533,7 @@ function statistics_admin_displaylog() { $output .= "<br />"; - $output .= "<h3>Recent users</h3>\n"; + $output .= "<h3>Recent user logs</h3>\n"; $output .= statistics_admin_accesslog_table(1, 0); $output .= "<br />"; @@ -908,6 +908,11 @@ function statistics_summary($dbfield, $dbrows) { } +// clean up statistics table when node is deleted +function statistics_node_delete($nid) { + db_query("DELETE FROM statistics WHERE nid = '%d'", $nid); +} + /* internal throttle function - do not call from other modules */ function throttle_update($recent_activity) { $throttle = throttle_status(); diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index b085f2b3d..8fbdfe0e7 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -341,7 +341,7 @@ function statistics_admin_accesslog_table($type, $id) { } else { /* retrieve recent access logs for all users */ - $result = db_query("SELECT nid, url, hostname, uid, MAX(timestamp) AS max_timestamp FROM accesslog WHERE uid <> '0' GROUP BY uid ORDER BY max_timestamp DESC LIMIT %s", $limit1); + $result = db_query("SELECT nid, url, hostname, uid, MAX(timestamp) AS timestamp FROM accesslog WHERE uid <> '0' GROUP BY uid ORDER BY timestamp DESC LIMIT %s", $limit1); } } else if ($type == 2) { @@ -533,7 +533,7 @@ function statistics_admin_displaylog() { $output .= "<br />"; - $output .= "<h3>Recent users</h3>\n"; + $output .= "<h3>Recent user logs</h3>\n"; $output .= statistics_admin_accesslog_table(1, 0); $output .= "<br />"; @@ -908,6 +908,11 @@ function statistics_summary($dbfield, $dbrows) { } +// clean up statistics table when node is deleted +function statistics_node_delete($nid) { + db_query("DELETE FROM statistics WHERE nid = '%d'", $nid); +} + /* internal throttle function - do not call from other modules */ function throttle_update($recent_activity) { $throttle = throttle_status(); |