From 40aa2e543bbac1261dc76a0d99248f0b4e2aa9e5 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 7 May 2010 04:35:10 +0000 Subject: [PATCH] Fix warnings in WordPress importer. props briancolinger, fixes #13263. git-svn-id: https://develop.svn.wordpress.org/trunk@14497 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/import/wordpress.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index 46d0c67b13..1db33f8e37 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -472,8 +472,8 @@ class WP_Import { $post_parent = (int) $post_parent; if ($post_parent) { // if we already know the parent, map it to the local ID - if ( $parent = $this->post_ids_processed[$post_parent] ) { - $post_parent = $parent; // new ID of the parent + if ( isset( $this->post_ids_processed[$post_parent] ) ) { + $post_parent = $this->post_ids_processed[$post_parent]; // new ID of the parent } else { // record the parent for later @@ -760,8 +760,12 @@ class WP_Import { global $wpdb; foreach ($this->orphans as $child_id => $parent_id) { - $local_child_id = $this->post_ids_processed[$child_id]; - $local_parent_id = $this->post_ids_processed[$parent_id]; + $local_child_id = $local_parent_id = false; + if ( isset( $this->post_ids_processed[$child_id] ) ) + $local_child_id = $this->post_ids_processed[$child_id]; + if ( isset( $this->post_ids_processed[$parent_id] ) ) + $local_parent_id = $this->post_ids_processed[$parent_id]; + if ($local_child_id and $local_parent_id) { $wpdb->update($wpdb->posts, array('post_parent' => $local_parent_id), array('ID' => $local_child_id) ); }