Make WordPress Core

Opened 16 years ago

Closed 14 years ago

#6265 closed defect (bug) (duplicate)

Wordpress importer skips posts having the same title during import process

Reported by: jayminkapish's profile jayminkapish Owned by: tellyworth's profile tellyworth
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: Import Keywords: needs-patch import
Focuses: Cc:

Description

I was importing couple of blogs to MU and I notice it was not importing everything. It skips posts with the same titles.

Well, I can not say it is a bug. I may be the only one who has posts with same titles. But I would like it to be accurate.

  1. wp-admin/import/wordpress.php - line number 320.

if ($post_id = post_exists($post_title, , $post_date)) {
post_exists function should pass $post_name to check whether post is exists or not! post_name is always unique in the database.
it should be
if ($post_id = post_exists($post_name,
, $post_date)) {

  1. wp-admin/includes/post.php - line number 172, 178 & 179

172 should be
function post_exists($post_name, $content = , $post_date = ) {
178 should be
if (!empty ($post_name))
179 should be
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$post_name' $post_date");

If this change occurs, then it should be changed in all the files under wp-admin/import/ folder.

I will attach the files I have changed.

Attachments (5)

wordpress.php (14.5 KB) - added by jayminkapish 16 years ago.
Wordpress Importer File
post.php (13.9 KB) - added by jayminkapish 16 years ago.
post.php which has post_exists function
wp-importer.patch (1.9 KB) - added by jayminkapish 16 years ago.
importer patch for wordpress
wpmu-importer.patch (1.7 KB) - added by jayminkapish 16 years ago.
importer patch for wordpress MU
wordpress-importer-new.patch (2.2 KB) - added by jayminkapish 16 years ago.
new patch for wordpress importer

Download all attachments as: .zip

Change History (16)

@jayminkapish
16 years ago

Wordpress Importer File

@jayminkapish
16 years ago

post.php which has post_exists function

#1 @ryan
16 years ago

  • Owner changed from anonymous to tellyworth

#2 @lloydbudd
16 years ago

jayminkapish, please don't attach modified files, instead attach a patch. Also, it looks liek you are using an older version of WordPress. Please provide your modification verses the current trunk. Thanks for participating in WordPress!

@jayminkapish
16 years ago

importer patch for wordpress

@jayminkapish
16 years ago

importer patch for wordpress MU

#3 @jayminkapish
16 years ago

Hi Lloyd,

Files I attached were of Wordpress MU. I am sorry I did not mention that.

I have attached two patches now. One of them is for Wordpress MU (wpmu-importer.patch) and other one is for Wordpress (wp-importer.patch).

Thanks, Jaymin

#4 follow-up: @jayminkapish
16 years ago

Also, post_exists() function is used by all other files under wp-admin/import/ folder. You may want to change something there. Thanks, Jaymin

#5 @lloydbudd
16 years ago

  • Keywords has-patch import added
  • Milestone changed from 2.7 to 2.6
  • Version set to 2.5

#6 in reply to: ↑ 4 @jayminkapish
16 years ago

Replying to jayminkapish:

Also, post_exists() function is used by all other files under wp-admin/import/ folder. You may want to change something there. Thanks, Jaymin

I found a fix to this issue. Rather than dealing with all files under wp-admin/import/, we can add one more optional parameter to post_exists function, post_name.
Patch attached: wordpress-importer-new.patch

@jayminkapish
16 years ago

new patch for wordpress importer

#7 @lloydbudd
16 years ago

  • Type changed from enhancement to defect

#8 @westi
16 years ago

We need to be careful what we change here as the idea is for all the importers that I can keep importing the same file until i have all the data imported if I hit a php runtime limit during the process.

#9 @Denis-de-Bernardy
15 years ago

  • Component changed from General to Import

#10 @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch added; has-patch removed

#11 @ryan
14 years ago

  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This was fixed some time ago by passing the date. Closing this as a dupe.

Note: See TracTickets for help on using tickets.