- Patch #16021 by tangent: changed the format "/blog/feed/52" to "/blog/52/feed".
parent
01b8e7fdf0
commit
dbcda92b76
|
@ -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);
|
||||
|
|
|
@ -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('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url("blog/feed/$account->uid") .'" />');
|
||||
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url("blog/$account->uid/feed") .'" />');
|
||||
print theme('page', $output);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -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('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url("blog/feed/$account->uid") .'" />');
|
||||
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url("blog/$account->uid/feed") .'" />');
|
||||
print theme('page', $output);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue