Commit 6baa7d7c authored by Dries's avatar Dries
Browse files

- Some URL alias fixes by Matt.
parent bcb5ebcd
......@@ -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;
......
......@@ -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);
}
}
/**
......
......@@ -47,7 +47,8 @@
"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
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment