summaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2004-08-07 21:20:41 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2004-08-07 21:20:41 +0000
commitdaf175182e42c2d35fdb744550117eb374e81fc9 (patch)
tree4f096186cfb57e2b9a406b7f821c6bcb7cbfaa8a /database
parent1e1144f10599d8f88117b30e494d5b6c7f78c17b (diff)
downloadbrdo-daf175182e42c2d35fdb744550117eb374e81fc9.tar.gz
brdo-daf175182e42c2d35fdb744550117eb374e81fc9.tar.bz2
- Adding an update to convert old taxonomy URL aliases to new ones.
Diffstat (limited to 'database')
-rw-r--r--database/updates.inc28
1 files changed, 27 insertions, 1 deletions
diff --git a/database/updates.inc b/database/updates.inc
index c472800bc..e2faae044 100644
--- a/database/updates.inc
+++ b/database/updates.inc
@@ -68,7 +68,8 @@ $sql_updates = array(
"2004-07-22" => "update_94",
"2004-07-30" => "update_95",
"2004-08-04" => "update_96",
- "2004-08-06" => "update_97"
+ "2004-08-06" => "update_97",
+ "2004-08-07" => "update_98"
);
function update_32() {
@@ -1282,6 +1283,31 @@ function update_97() {
return array();
}
+function update_98() {
+ $result = db_query("SELECT pid, src FROM {url_alias} WHERE src LIKE 'taxonomy/%%'", $from);
+ while ($alias = db_fetch_object($result)) {
+ list(, $page, $op, $terms) = explode('/', $alias->src);
+ if ($page == 'feed' || $page == 'page') {
+ switch ($op) {
+ case 'or':
+ $new = 'taxonomy/terms/'. str_replace(',', '+', $terms);
+ break;
+ case 'and':
+ $new = 'taxonomy/terms/'. $terms;
+ break;
+ }
+ if ($new) {
+ if ($page == 'feed') {
+ $new .= '/0/feed';
+ }
+ db_query("UPDATE {url_alias} SET src = '%s' WHERE pid = '%s'", $new, $alias->pid);
+ }
+ }
+ }
+
+ return array();
+}
+
function update_sql($sql) {
$edit = $_POST["edit"];
$result = db_query($sql);