diff --git a/database/updates.inc b/database/updates.inc
index f41f1d2e1ac..6ebe8477480 100644
--- a/database/updates.inc
+++ b/database/updates.inc
@@ -95,7 +95,8 @@ $sql_updates = array(
"2005-01-14" => "update_116",
"2005-01-18" => "update_117",
"2005-01-19" => "update_118",
- "2005-01-20" => "update_119"
+ "2005-01-20" => "update_119",
+ "2005-01-25" => "update_120"
);
function update_32() {
@@ -2142,6 +2143,24 @@ function update_119() {
return $ret;
}
+function update_120() {
+ // Add column to the blocks table.
+ $ret = array();
+ $ret[] = update_sql("ALTER TABLE {blocks} ADD types varchar(16)");
+
+ // Rewrite old URL aliases. Works for both PostgreSQL and MySQL
+ $result = db_query("SELECT pid, src FROM {url_alias} WHERE src LIKE 'blog/%%'");
+ while ($alias = db_fetch_object($result)) {
+ list(, $page, $op, $uid) = explode('/', $alias->src);
+ if ($page == 'feed') {
+ $new = "blog/$uid/feed";
+ update_sql("UPDATE {url_alias} SET src = '%s' WHERE pid = '%s'", $new, $alias->pid);
+ }
+ }
+
+ return $ret;
+}
+
function update_sql($sql) {
$edit = $_POST["edit"];
$result = db_query($sql);
diff --git a/modules/blog.module b/modules/blog.module
index 6070d193ddf..dc40360c5aa 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -162,9 +162,9 @@ function blog_page_user($uid) {
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
}
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
- $output .= theme('xml_icon', url("blog/feed/$account->uid"));
+ $output .= theme('xml_icon', url("blog/$account->uid/feed"));
- drupal_set_html_head('uid") .'" />');
+ drupal_set_html_head('uid/feed") .'" />');
print theme('page', $output);
}
else {
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 6070d193ddf..dc40360c5aa 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -162,9 +162,9 @@ function blog_page_user($uid) {
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
}
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
- $output .= theme('xml_icon', url("blog/feed/$account->uid"));
+ $output .= theme('xml_icon', url("blog/$account->uid/feed"));
- drupal_set_html_head('uid") .'" />');
+ drupal_set_html_head('uid/feed") .'" />');
print theme('page', $output);
}
else {
diff --git a/modules/legacy.module b/modules/legacy.module
index 39ffc8b8c10..882298fa48b 100644
--- a/modules/legacy.module
+++ b/modules/legacy.module
@@ -34,6 +34,11 @@ function legacy_menu($may_cache) {
$items[] = array('path' => 'taxonomy/feed', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_feed',
'access' => TRUE, 'type' => MENU_CALLBACK);
+
+ // Map "blog/feed/52" to "blog/52/feed".
+ $items[] = array('path' => 'blog/feed', 'title' => t('blog'),
+ 'callback' => 'legacy_blog_feed',
+ 'access' => TRUE, 'type' => MENU_CALLBACK);
}
else {
// Map "node/view/52" to "node/52".
@@ -78,6 +83,17 @@ function legacy_taxonomy_feed($operation = 'or', $str_tids = '') {
drupal_goto('taxonomy/term/'. $str_tids .'/0/feed');
}
+/**
+ * Menu callback; redirects users to new blog feed paths.
+ */
+function legacy_blog_feed($str_uid = '') {
+ // if URL is of form blog/feed/52 redirect
+ // if URL is of form blog/feed no need to redirect
+ if (is_numeric($str_uid)) {
+ drupal_goto('blog/'. $str_uid .'/feed');
+ }
+}
+
/**
* Implementation of hook_filter(). Handles URL upgrades from Drupal 4.1.
*/
diff --git a/modules/legacy/legacy.module b/modules/legacy/legacy.module
index 39ffc8b8c10..882298fa48b 100644
--- a/modules/legacy/legacy.module
+++ b/modules/legacy/legacy.module
@@ -34,6 +34,11 @@ function legacy_menu($may_cache) {
$items[] = array('path' => 'taxonomy/feed', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_feed',
'access' => TRUE, 'type' => MENU_CALLBACK);
+
+ // Map "blog/feed/52" to "blog/52/feed".
+ $items[] = array('path' => 'blog/feed', 'title' => t('blog'),
+ 'callback' => 'legacy_blog_feed',
+ 'access' => TRUE, 'type' => MENU_CALLBACK);
}
else {
// Map "node/view/52" to "node/52".
@@ -78,6 +83,17 @@ function legacy_taxonomy_feed($operation = 'or', $str_tids = '') {
drupal_goto('taxonomy/term/'. $str_tids .'/0/feed');
}
+/**
+ * Menu callback; redirects users to new blog feed paths.
+ */
+function legacy_blog_feed($str_uid = '') {
+ // if URL is of form blog/feed/52 redirect
+ // if URL is of form blog/feed no need to redirect
+ if (is_numeric($str_uid)) {
+ drupal_goto('blog/'. $str_uid .'/feed');
+ }
+}
+
/**
* Implementation of hook_filter(). Handles URL upgrades from Drupal 4.1.
*/