diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-08-06 22:43:12 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-08-06 22:43:12 +0000 |
commit | 3e39fa864a58160acbc35cbc2ecf1adf9d42d905 (patch) | |
tree | a0f9e92a817ffb00b743e5cf2e6e64fdff7499f4 | |
parent | 821c6d2d17892ba4b4cfb7771e94953a1e3d5dac (diff) | |
download | brdo-3e39fa864a58160acbc35cbc2ecf1adf9d42d905.tar.gz brdo-3e39fa864a58160acbc35cbc2ecf1adf9d42d905.tar.bz2 |
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.
-rw-r--r-- | database/updates.inc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/database/updates.inc b/database/updates.inc index 3d7f408e9..c472800bc 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -67,7 +67,8 @@ $sql_updates = array( "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); |