summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--database/database.mysql4
-rw-r--r--includes/common.inc4
-rw-r--r--update.php22
3 files changed, 26 insertions, 4 deletions
diff --git a/database/database.mysql b/database/database.mysql
index f4438cd33..ce823b2c1 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -306,10 +306,10 @@ CREATE TABLE page (
--
CREATE TABLE path (
- alid int(10) unsigned NOT NULL auto_increment,
+ pid int(10) unsigned NOT NULL auto_increment,
old varchar(128) NOT NULL default '',
new varchar(128) NOT NULL default '',
- PRIMARY KEY (alid),
+ PRIMARY KEY (pid),
UNIQUE KEY new (new),
UNIQUE KEY old (old)
) TYPE=MyISAM;
diff --git a/includes/common.inc b/includes/common.inc
index cf9876767..a1ad701aa 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1076,7 +1076,9 @@ function form_allowed_tags_text() {
function get_url_alias($path) {
$map = get_url_map();
- return array_search($path, $map);
+ if ($map) {
+ return array_search($path, $map);
+ }
}
/**
diff --git a/update.php b/update.php
index 1a88cf5fd..d27375187 100644
--- a/update.php
+++ b/update.php
@@ -47,7 +47,8 @@ $mysql_updates = array(
"2003-08-27" => "update_62",
"2003-09-09" => "update_63",
"2003-09-10" => "update_64",
- "2003-09-29" => "update_65"
+ "2003-09-29" => "update_65",
+ "2003-09-30" => "update_66"
);
function update_32() {
@@ -457,6 +458,25 @@ function update_65() {
}
}
+function update_66() {
+ update_sql("CREATE TABLE path (
+ pid int(10) unsigned NOT NULL auto_increment,
+ old varchar(128) NOT NULL default '',
+ new varchar(128) NOT NULL default '',
+ PRIMARY KEY (pid),
+ UNIQUE KEY old (old),
+ UNIQUE KEY new (new)
+ )");
+
+ // Migrate the existing paths:
+ $result = db_query("SELECT nid, path FROM {node} WHERE path != ''");
+ while ($node = db_fetch_object($result)) {
+ update_sql("INSERT INTO {path} (old, new) VALUES ('node/view/$node->nid', '". check_query($node->path) ."')");
+ }
+
+ update_sql("ALTER TABLE {node} DROP path");
+ }
+
/*
** System functions
*/