WordPress.org

Make WordPress Core

Changeset 12469


Ignore:
Timestamp:
12/21/2009 03:26:57 PM (11 years ago)
Author:
westi
Message:

Fix some notices in the importer when importing files from old WordPress versions or not fetching attachments. See #11484.
Ensure that we check that a user is created for the username we specify and otherwise fallback to the current user
See #10319.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import/wordpress.php

    r12301 r12469  
    6161        global $wpdb;
    6262        preg_match("|<$tag.*?>(.*?)</$tag>|is", $string, $return);
    63         $return = preg_replace('|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1]);
    64         $return = $wpdb->escape( trim( $return ) );
     63        if ( isset($return[1]) ) {
     64            $return = preg_replace('|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1]);
     65            $return = $wpdb->escape( trim( $return ) );
     66        } else {
     67            $return = '';
     68        }
    6569        return $return;
    6670    }
     
    191195                    $user_id = wp_create_user($new_author_name, wp_generate_password());
    192196                }
    193 
    194                 $this->author_ids[$in_author_name] = $user_id;
     197               
     198                if ( !is_wp_error( $user_id ) ) {
     199                    $this->author_ids[$in_author_name] = $user_id;
     200                }
    195201            }
    196202
     
    843849            case 2:
    844850                check_admin_referer('import-wordpress');
    845                 $result = $this->import( $_GET['id'], $_POST['attachments'] );
     851                $fetch_attachments = (!empty($_POST['attachments'])) ? true : false;
     852                $result = $this->import( $_GET['id'], $fetch_attachments);
    846853                if ( is_wp_error( $result ) )
    847854                    echo $result->get_error_message();
Note: See TracChangeset for help on using the changeset viewer.