From 9b8483289d46849b8b076161bf666de86ffa6d36 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Tue, 1 Feb 2005 10:04:01 +0000 Subject: [PATCH] Preserve GUIDs in imports git-svn-id: http://svn.automattic.com/wordpress/trunk@2193 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/import-rss.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-admin/import-rss.php b/wp-admin/import-rss.php index 327e507e73..55bf89aa24 100644 --- a/wp-admin/import-rss.php +++ b/wp-admin/import-rss.php @@ -110,6 +110,10 @@ if (!$categories) : $categories = $categories[1]; endif; +preg_match('|(.*?)|is', $post, $guid); +if ($guid) $guid = addslashes( trim($guid[1]) ); +else $guid = ''; + preg_match('|(.*?)|is', $post, $content); $content = str_replace( array(''), '', addslashes( trim($content[1]) ) ); @@ -137,9 +141,9 @@ if ($dupe) : else : $wpdb->query("INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name) + (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name, guid) VALUES - ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')"); + ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name', '$guid')"); $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); if (!$post_id) die("couldn't get post ID"); if (0 != count($categories)) :