diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-10-11 12:25:25 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-10-11 12:25:25 +0000 |
commit | 959cae82224e799e7bf9f5b8efd2fa9877058dca (patch) | |
tree | c0933b66dcce0380d7799f7145e205eba5f87e46 | |
parent | d62b6dedaa4f4228dc5f42f61009f8deadb097ce (diff) | |
download | brdo-959cae82224e799e7bf9f5b8efd2fa9877058dca.tar.gz brdo-959cae82224e799e7bf9f5b8efd2fa9877058dca.tar.bz2 |
- added sequence tables
- fixed bug in node_page()
- fixed bug in db_result()
- fixed rss glitch
-rw-r--r-- | includes/database.inc | 2 | ||||
-rw-r--r-- | includes/node.inc | 26 | ||||
-rw-r--r-- | modules/node.module | 4 | ||||
-rw-r--r-- | modules/node/node.module | 4 | ||||
-rw-r--r-- | updates/3.00-to-x.xx.php | 27 |
5 files changed, 45 insertions, 18 deletions
diff --git a/includes/database.inc b/includes/database.inc index be3bdbf17..a3da55254 100644 --- a/includes/database.inc +++ b/includes/database.inc @@ -45,7 +45,7 @@ function db_num_rows($result) { function db_result($result, $field = 0) { if ($result) { - $tmp = $result->fetchRow(DB_FETCHMODE_ASSOC); + $tmp = $result->fetchRow(DB_FETCHMODE_ORDERED); return $tmp[$field]; } } diff --git a/includes/node.inc b/includes/node.inc index 747c8d8b4..0fac085e3 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -133,29 +133,29 @@ function node_save($node, $filter) { $v2 = implode(", ", $v2); - $result = db_query ("BEGIN"); - if (db_error ($result)) { - watchdog ("error", "database: ". $result->getMessage () ."\nquery: ". htmlspecialchars ("BEGIN")); + $result = db_query("BEGIN"); + if (db_error($result)) { + watchdog("error", "database: ". $result->getMessage() ."\nquery: ". htmlspecialchars("BEGIN")); } else { - $nid = $db_handle->nextId ("node_nid"); - $lid = $db_handle->nextId ($filter[type] . "_lid"); + $nid = $db_handle->nextId("node"); + $lid = $db_handle->nextId($filter[type]); - $result = db_query ("INSERT INTO node ($f1, nid, lid) VALUES ($v1, '$nid', '$lid')"); - if (db_error ($result)) { + $result = db_query("INSERT INTO node ($f1, nid, lid) VALUES ($v1, '$nid', '$lid')"); + if (db_error($result)) { watchdog("warning", "node: added $filter[type] '$node[title]' - failed"); } else { - $result = db_query ("INSERT INTO $filter[type] ($f2, nid, lid) VALUES ($v2, '$nid', '$lid')"); - if (db_error ($result)) { + $result = db_query("INSERT INTO $filter[type] ($f2, nid, lid) VALUES ($v2, '$nid', '$lid')"); + if (db_error($result)) { watchdog("warning", "node: added $filter[type] '$node[title]' - failed"); } else { - $result = db_query ("COMMIT"); - if (db_error ($result)) { - watchdog ("error", "database: ". $result->getMessage () ."\nquery: ". htmlspecialchars ("BEGIN")); - $db_handle->rollback (); + $result = db_query("COMMIT"); + if (db_error($result)) { + watchdog("error", "database: ". $result->getMessage() ."\nquery: ". htmlspecialchars("BEGIN")); + $db_handle->rollback(); } watchdog("special", "node: added $filter[type] '$node[title]'"); } diff --git a/modules/node.module b/modules/node.module index 0f0573815..bc40e6ba5 100644 --- a/modules/node.module +++ b/modules/node.module @@ -407,7 +407,7 @@ function node_feed() { $output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"; $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n"; $output .= "<rss version=\"0.91\">\n"; - $output .= format_rss_channel(variable_get("site_name", "drupal"), path_uri() ."module.php?mod=node&op=feed", variable_get("site_slogan", ""), $items); + $output .= format_rss_channel(variable_get("site_name", "drupal"), path_uri(), variable_get("site_slogan", ""), $items); $output .= "</rss>\n"; header("Content-Type: text/xml"); @@ -417,7 +417,7 @@ function node_feed() { } function node_page() { - global $op, $theme; + global $op, $theme, $meta, $date; if ($op == "feed") { node_feed(); diff --git a/modules/node/node.module b/modules/node/node.module index 0f0573815..bc40e6ba5 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -407,7 +407,7 @@ function node_feed() { $output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"; $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n"; $output .= "<rss version=\"0.91\">\n"; - $output .= format_rss_channel(variable_get("site_name", "drupal"), path_uri() ."module.php?mod=node&op=feed", variable_get("site_slogan", ""), $items); + $output .= format_rss_channel(variable_get("site_name", "drupal"), path_uri(), variable_get("site_slogan", ""), $items); $output .= "</rss>\n"; header("Content-Type: text/xml"); @@ -417,7 +417,7 @@ function node_feed() { } function node_page() { - global $op, $theme; + global $op, $theme, $meta, $date; if ($op == "feed") { node_feed(); diff --git a/updates/3.00-to-x.xx.php b/updates/3.00-to-x.xx.php new file mode 100644 index 000000000..06955d4dc --- /dev/null +++ b/updates/3.00-to-x.xx.php @@ -0,0 +1,27 @@ +<?php + +/* +** Move this file to the root of your Drupal tree and access it (execute +** it) through your browser. Make sure to delete this file afterwards so +** it can not be accessed by Malicious Mallory. +*/ + +include "includes/common.inc"; + +/* +** Create sequence tables for pear-ification of MySQL +*/ + +foreach (module_list() as $name) { + if (module_hook($name, "status")) { + print "$name ..."; + db_query("DROP TABLE IF EXISTS ". $name ."_seq"); + db_query("CREATE TABLE ". $name ."_seq (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY(id))"); + $result = db_query("SELECT MAX(". ($name == "node" ? "nid" : "lid") .") FROM $name", 1); + $count = $result ? db_result($result, 0) : 0; + db_query("INSERT INTO ". $name ."_seq (id) VALUES ('$count')"); + print "done ($count)<br />"; + } +} + +?>
\ No newline at end of file |