summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-10-13 12:00:50 +0000
committerDries Buytaert <dries@buytaert.net>2002-10-13 12:00:50 +0000
commitfcae7030cce39357d197d668629399eeb557f5a2 (patch)
tree8bb84cfd65abefc81b1bda186a1de669c899ff3c /update.php
parent30315c40c089ff0cab1abd4916e5d992e48185ae (diff)
downloadbrdo-fcae7030cce39357d197d668629399eeb557f5a2.tar.gz
brdo-fcae7030cce39357d197d668629399eeb557f5a2.tar.bz2
- Committed Jeremy's incarnation of the statistics module. Last minutes
changes include: * a couple of coding style changes, renamed some "stats" into "statistics", etc. * removed the "Who's online" block from the user module. * added db_affected_rows() to the resp. database abstraction layers and made the statistics module use db_affected_rows() instead. * added update logic to "update.php".
Diffstat (limited to 'update.php')
-rw-r--r--update.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/update.php b/update.php
index a67b923d2..1aeb96113 100644
--- a/update.php
+++ b/update.php
@@ -52,7 +52,8 @@ $mysql_updates = array(
"2002-08-19" => "update_37",
"2002-08-26" => "update_38",
"2002-09-15" => "update_39",
- "2002-09-17" => "update_40"
+ "2002-09-17" => "update_40",
+ "2002-10-13" => "update_41"
);
// Update functions
@@ -588,6 +589,33 @@ function update_40() {
}
}
+function update_41() {
+ if (db_result(db_query("SELECT COUNT(daycount) FROM statistics;")) > 0) {
+ // NOTE: "daycount" is a newly introduced field so we use that to determine whether we need to wipe the tables.
+
+ update_sql("DROP TABLE IF EXISTS statistics;");
+ update_sql("CREATE TABLE statistics (
+ nid int(11) NOT NULL,
+ totalcount bigint UNSIGNED DEFAULT '0' NOT NULL,
+ daycount mediumint UNSIGNED DEFAULT '0' NOT NULL,
+ timestamp int(11) UNSIGNED DEFAULT '0' NOT NULL,
+ PRIMARY KEY (nid),
+ INDEX (totalcount),
+ INDEX (daycount),
+ INDEX (timestamp)
+ );");
+
+ update_sql("DROP TABLE IF EXISTS accesslog;");
+ update_sql("CREATE TABLE accesslog (
+ nid int(11) UNSIGNED DEFAULT '0',
+ url varchar(255),
+ hostname varchar(128),
+ uid int(10) UNSIGNED DEFAULT '0',
+ timestamp int(11) UNSIGNED NOT NULL
+ );");
+ }
+}
+
function update_upgrade3() {
update_sql("INSERT INTO system VALUES ('archive.module','archive','module','',1);");
update_sql("INSERT INTO system VALUES ('block.module','block','module','',1);");