Commit 3e39fa86 authored by Steven Wittens's avatar Steven Wittens

Added an upgrade path for old URL aliases to node/view, book/view and...

Added an upgrade path for old URL aliases to node/view, book/view and user/view. This is amongst other things required for old node aliases to appear in the node form.
parent 821c6d2d
......@@ -67,7 +67,8 @@
"2004-07-11" => "update_93",
"2004-07-22" => "update_94",
"2004-07-30" => "update_95",
"2004-08-04" => "update_96"
"2004-08-04" => "update_96",
"2004-08-06" => "update_97"
);
function update_32() {
......@@ -1269,6 +1270,18 @@ function update_96() {
return $ret;
}
function update_97() {
$convert = array('node/view/' => 'node/', 'book/view/' => 'book/', 'user/view/' => 'user/');
foreach ($convert as $from => $to) {
$result = db_query("SELECT pid, src FROM {url_alias} WHERE src LIKE '%s%%'", $from);
while ($alias = db_fetch_object($result)) {
db_query("UPDATE {url_alias} SET src = '%s' WHERE pid = '%s'", str_replace($from, $to, $alias->src), $alias->pid);
}
}
return array();
}
function update_sql($sql) {
$edit = $_POST["edit"];
$result = db_query($sql);
......
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