diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-10-22 20:20:35 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-10-22 20:20:35 +0000 |
commit | 72ae2d39953125a231592d2a2b7ad14afe35b1bd (patch) | |
tree | 1b261d628460a8db3775d6d83c1f928d2726ce1d /modules | |
parent | 742410aafdf3d85ec3f0060e5c9fd1d09ee71672 (diff) | |
download | brdo-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')
-rw-r--r-- | modules/node.module | 8 | ||||
-rw-r--r-- | modules/node/node.module | 8 | ||||
-rw-r--r-- | modules/path.module | 26 | ||||
-rw-r--r-- | modules/path/path.module | 26 | ||||
-rw-r--r-- | modules/statistics.module | 16 | ||||
-rw-r--r-- | modules/statistics/statistics.module | 16 |
6 files changed, 50 insertions, 50 deletions
diff --git a/modules/node.module b/modules/node.module index a2d6677e4..f14775446 100644 --- a/modules/node.module +++ b/modules/node.module @@ -627,12 +627,12 @@ function node_admin_nodes() { ** Handle operations: */ - if (empty($_SESSION["node-overview-filter"])) { - $_SESSION["node-overview-filter"] = 0; + if (empty($_SESSION["node_overview_filter"])) { + $_SESSION["node_overview_filter"] = 0; } if (isset($_POST["edit"]["filter"])) { - $_SESSION["node-overview-filter"] = $_POST["edit"]["filter"]; + $_SESSION["node_overview_filter"] = $_POST["edit"]["filter"]; } if (isset($_POST["edit"]["operation"])) { @@ -646,7 +646,7 @@ function node_admin_nodes() { $output = status(t("the update has been performed.")); } - $filter = $_SESSION["node-overview-filter"]; + $filter = $_SESSION["node_overview_filter"]; /* ** Render filter form: diff --git a/modules/node/node.module b/modules/node/node.module index a2d6677e4..f14775446 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -627,12 +627,12 @@ function node_admin_nodes() { ** Handle operations: */ - if (empty($_SESSION["node-overview-filter"])) { - $_SESSION["node-overview-filter"] = 0; + if (empty($_SESSION["node_overview_filter"])) { + $_SESSION["node_overview_filter"] = 0; } if (isset($_POST["edit"]["filter"])) { - $_SESSION["node-overview-filter"] = $_POST["edit"]["filter"]; + $_SESSION["node_overview_filter"] = $_POST["edit"]["filter"]; } if (isset($_POST["edit"]["operation"])) { @@ -646,7 +646,7 @@ function node_admin_nodes() { $output = status(t("the update has been performed.")); } - $filter = $_SESSION["node-overview-filter"]; + $filter = $_SESSION["node_overview_filter"]; /* ** Render filter form: diff --git a/modules/path.module b/modules/path.module index 0211ad910..29cc81ddc 100644 --- a/modules/path.module +++ b/modules/path.module @@ -47,28 +47,28 @@ function path_admin() { function path_set_alias($path = NULL, $alias = NULL) { if ($path && !$alias) { - db_query("DELETE FROM {path} WHERE src = '%s'", $path); + db_query("DELETE FROM {url_alias} WHERE src = '%s'", $path); drupal_rebuild_path_map(); } else if (!$path && $alias) { - db_query("DELETE FROM {path} WHERE dst = '%s'", $alias); + db_query("DELETE FROM {url_alias} WHERE dst = '%s'", $alias); drupal_rebuild_path_map(); } else if ($path && $alias) { - $path_count = db_result(db_query("SELECT COUNT(src) FROM {path} WHERE src = '%s'", $path)); - $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {path} WHERE dst = '%s'", $alias)); + $path_count = db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE src = '%s'", $path)); + $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s'", $alias)); // We have an insert: if ($path_count == 0 && $alias_count == 0) { - db_query("INSERT INTO {path} SET src = '%s', dst = '%s'", $path, $alias); + db_query("INSERT INTO {url_alias} SET src = '%s', dst = '%s'", $path, $alias); drupal_rebuild_path_map(); } else if ($path_count == 1 && $alias_count == 0) { - db_query("UPDATE {path} SET dst = '%s' WHERE src = '%s'", $alias, $path); + db_query("UPDATE {url_alias} SET dst = '%s' WHERE src = '%s'", $alias, $path); drupal_rebuild_path_map(); } else if ($path_count == 0 && $alias_count == 1) { - db_query("UPDATE {path} SET src = '%s' WHERE dst = '%s'", $path, $alias); + db_query("UPDATE {url_alias} SET src = '%s' WHERE dst = '%s'", $path, $alias); drupal_rebuild_path_map(); } else if ($path_count == 1 && $alias_count == 1) { @@ -154,7 +154,7 @@ function path_nodeapi(&$node, $op, $arg) { $error["path"] = t("The path is invalid."); return $error; } - else if (db_result(db_query("SELECT COUNT(dst) FROM {path} WHERE dst = '%s' AND src != '%s'", $node->path, "node/view/$node->nid"))) { + else if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'", $node->path, "node/view/$node->nid"))) { $error["path"] = t("The path is already in use."); return $error; } @@ -191,7 +191,7 @@ function path_perm() { } function path_overview() { - $sql = "SELECT * FROM {path}"; + $sql = "SELECT * FROM {url_alias}"; $header = array( array ("data" => t("alias"), "field" => "dst", "sort" => "asc"), array ("data" => t("normal"), "field" => "src"), @@ -216,7 +216,7 @@ function path_overview() { } function path_load($pid) { - return db_fetch_array(db_query("SELECT * FROM {path} WHERE pid = '%d'", $pid)); + return db_fetch_array(db_query("SELECT * FROM {url_alias} WHERE pid = '%d'", $pid)); } function path_delete($pid) { @@ -233,7 +233,7 @@ function path_save($edit) { $error[] = t("the normal path '%src' is invalid.", array("%src" => $src)); } - if (db_result(db_query("SELECT COUNT(src) FROM {path} WHERE pid != '%d' AND src = '%s'", $pid, $src))) { + if (db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE pid != '%d' AND src = '%s'", $pid, $src))) { $error[] = t("the normal path '%src' is already aliased.", array("%src" => $src)); } @@ -241,7 +241,7 @@ function path_save($edit) { $error[] = t("the alias '%dst' is invalid.", array("%dst" => $dst)); } - if (db_result(db_query("SELECT COUNT(dst) FROM {path} WHERE pid != '%d' AND dst = '%s'", $pid, $dst))) { + if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != '%d' AND dst = '%s'", $pid, $dst))) { $error[] = t("the alias '%dst' is already in use.", array("%dst" => $dst)); } @@ -256,7 +256,7 @@ function path_save($edit) { */ if ($pid) { - db_query("UPDATE {path} SET src = '%s', dst = '%s' WHERE pid = '%d'", $src, $dst, $pid); + db_query("UPDATE {url_alias} SET src = '%s', dst = '%s' WHERE pid = '%d'", $src, $dst, $pid); } else { path_set_alias($src, $dst); diff --git a/modules/path/path.module b/modules/path/path.module index 0211ad910..29cc81ddc 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -47,28 +47,28 @@ function path_admin() { function path_set_alias($path = NULL, $alias = NULL) { if ($path && !$alias) { - db_query("DELETE FROM {path} WHERE src = '%s'", $path); + db_query("DELETE FROM {url_alias} WHERE src = '%s'", $path); drupal_rebuild_path_map(); } else if (!$path && $alias) { - db_query("DELETE FROM {path} WHERE dst = '%s'", $alias); + db_query("DELETE FROM {url_alias} WHERE dst = '%s'", $alias); drupal_rebuild_path_map(); } else if ($path && $alias) { - $path_count = db_result(db_query("SELECT COUNT(src) FROM {path} WHERE src = '%s'", $path)); - $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {path} WHERE dst = '%s'", $alias)); + $path_count = db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE src = '%s'", $path)); + $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s'", $alias)); // We have an insert: if ($path_count == 0 && $alias_count == 0) { - db_query("INSERT INTO {path} SET src = '%s', dst = '%s'", $path, $alias); + db_query("INSERT INTO {url_alias} SET src = '%s', dst = '%s'", $path, $alias); drupal_rebuild_path_map(); } else if ($path_count == 1 && $alias_count == 0) { - db_query("UPDATE {path} SET dst = '%s' WHERE src = '%s'", $alias, $path); + db_query("UPDATE {url_alias} SET dst = '%s' WHERE src = '%s'", $alias, $path); drupal_rebuild_path_map(); } else if ($path_count == 0 && $alias_count == 1) { - db_query("UPDATE {path} SET src = '%s' WHERE dst = '%s'", $path, $alias); + db_query("UPDATE {url_alias} SET src = '%s' WHERE dst = '%s'", $path, $alias); drupal_rebuild_path_map(); } else if ($path_count == 1 && $alias_count == 1) { @@ -154,7 +154,7 @@ function path_nodeapi(&$node, $op, $arg) { $error["path"] = t("The path is invalid."); return $error; } - else if (db_result(db_query("SELECT COUNT(dst) FROM {path} WHERE dst = '%s' AND src != '%s'", $node->path, "node/view/$node->nid"))) { + else if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'", $node->path, "node/view/$node->nid"))) { $error["path"] = t("The path is already in use."); return $error; } @@ -191,7 +191,7 @@ function path_perm() { } function path_overview() { - $sql = "SELECT * FROM {path}"; + $sql = "SELECT * FROM {url_alias}"; $header = array( array ("data" => t("alias"), "field" => "dst", "sort" => "asc"), array ("data" => t("normal"), "field" => "src"), @@ -216,7 +216,7 @@ function path_overview() { } function path_load($pid) { - return db_fetch_array(db_query("SELECT * FROM {path} WHERE pid = '%d'", $pid)); + return db_fetch_array(db_query("SELECT * FROM {url_alias} WHERE pid = '%d'", $pid)); } function path_delete($pid) { @@ -233,7 +233,7 @@ function path_save($edit) { $error[] = t("the normal path '%src' is invalid.", array("%src" => $src)); } - if (db_result(db_query("SELECT COUNT(src) FROM {path} WHERE pid != '%d' AND src = '%s'", $pid, $src))) { + if (db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE pid != '%d' AND src = '%s'", $pid, $src))) { $error[] = t("the normal path '%src' is already aliased.", array("%src" => $src)); } @@ -241,7 +241,7 @@ function path_save($edit) { $error[] = t("the alias '%dst' is invalid.", array("%dst" => $dst)); } - if (db_result(db_query("SELECT COUNT(dst) FROM {path} WHERE pid != '%d' AND dst = '%s'", $pid, $dst))) { + if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != '%d' AND dst = '%s'", $pid, $dst))) { $error[] = t("the alias '%dst' is already in use.", array("%dst" => $dst)); } @@ -256,7 +256,7 @@ function path_save($edit) { */ if ($pid) { - db_query("UPDATE {path} SET src = '%s', dst = '%s' WHERE pid = '%d'", $src, $dst, $pid); + db_query("UPDATE {url_alias} SET src = '%s', dst = '%s' WHERE pid = '%d'", $src, $dst, $pid); } else { path_set_alias($src, $dst); 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); } } 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); } } |