Changeset 2428

Show
Ignore:
Timestamp:
09/01/08 18:10:36 (3 months ago)
Author:
ringmaster
Message:

Update to WP importer to prevent stalls when the userid associated to a post in the WP database doesn't exist in the WP user table.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/htdocs/system/plugins/wpimport/wpimport.plugin.php

    r2416 r2428  
    358358                $p= new Post( $post_array ); 
    359359                $p->slug= $post->slug; 
    360                 $p->user_id = $user_map[$p->user_id]; 
     360                if(isset($user_map[$p->user_id])) { 
     361                    $p->user_id = $user_map[$p->user_id]; 
     362                } 
     363                else { 
     364                    $errors = Options::get('import_errors'); 
     365                    $errors[] = _t('Post author id %s was not found in WP database, assigning post "%s" (WP post id #%d) to current user.', array($p->user_id, $p->title,$post_array['id']) ); 
     366                    Options::set('import_errors', $errors); 
     367                    $p->user_id = User::identify()->id; 
     368                } 
     369 
    361370                $p->guid= $p->guid; // Looks fishy, but actually causes the guid to be set. 
    362371                $p->tags= $tags;