Set GUID on upgrade. CURRENTLY NOT WORKING. For some reason the get_settings calls aren't working.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-09-05 02:41:01 +00:00
parent ed34ca04d8
commit c54f9a539f
2 changed files with 57 additions and 55 deletions

View File

@ -147,13 +147,18 @@ function upgrade_130() {
global $wpdb, $table_prefix;
// Remove extraneous backslashes.
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt FROM $wpdb->posts");
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
if ($posts) {
foreach($posts as $post) {
$post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt));
$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt' WHERE ID = '$post->ID'");
if ( empty($post->guid) )
$guid = get_option('home') . '/' . get_permalink();
else
$guid = $post->guid;
$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
}
}

View File

@ -28,7 +28,6 @@ function permalink_single_rss($file = '') {
function get_permalink($id = false) {
global $post, $wpdb;
global $querystring_start, $querystring_equal;
$rewritecode = array(
'%year%',
@ -53,9 +52,8 @@ function get_permalink($id=false) {
$permalink = get_settings('permalink_structure');
if ('' != $permalink) {
if ($idpost->post_status == 'static') {
if ($idpost->post_status == 'static')
$permalink = page_permastruct();
}
$unixtime = strtotime($idpost->post_date);
@ -63,8 +61,8 @@ function get_permalink($id=false) {
$category = $cats[0]->category_nicename;
$authordata = get_userdata($idpost->post_author);
$author = $authordata->user_nicename;
$rewritereplace = array(
$rewritereplace =
array(
date('Y', $unixtime),
date('m', $unixtime),
date('d', $unixtime),
@ -79,10 +77,9 @@ function get_permalink($id=false) {
);
return get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink);
} else { // if they're not using the fancy permalink option
$permalink = get_settings('home') . '/' . get_settings('blogfilename').$querystring_start.'p'.$querystring_equal.$idpost->ID;
if ($idpost->post_status == 'static') {
$permalink .= $querystring_separator . "static=1";
}
$permalink = get_settings('home') . '/' . get_settings('blogfilename') . '?p=' . $idpost->ID;
if ($idpost->post_status == 'static')
$permalink .= '&static=1';
return $permalink;
}
}