Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
Don't return on non-blocking errors #51
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaber-de committed Jan 29, 2016
1 parent 7dc96a6 commit 6645f3d
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions inc/Import/Service/WpPostImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ public function import_post( Type\ImportPostInterface $import_post ) {
$local_parent_id = $this->id_mapper->local_id( 'post', $import_post->origin_parent_post_id() );
$local_user_id = $this->id_mapper->local_id( 'user', $import_post->origin_author_id() );

/**
* trigger action if local user id not solved
*/
if ( ! $local_user_id ) {

$error = new WP_Error( 'local_user_id_missing', "Local user is empty or 0." );

/**
* @param WP_Post $wp_post
* @param Type\ImportPostInterface $import_post
*/
do_action( 'w2m_import_missing_post_local_user_id', $error, $import_post );
}

$import_postdata = array(
'post_title' => $import_post->title(),
'post_author' => $local_user_id,
Expand Down Expand Up @@ -128,24 +142,6 @@ public function import_post( Type\ImportPostInterface $import_post ) {
* @param Type\ImportPostInterface $import_post
*/
do_action( 'w2m_import_missing_post_ancestor', $wp_post, $import_post );

return;
}

/**
* trigger action if local user id not solved
*/
if ( empty( $local_user_id ) || $local_user_id == 0 ) {

$error = new WP_Error( 'local_user_id_missing', "Local user is empty or 0." );

/**
* @param stdClass|WP_Post $wp_post
* @param Type\ImportPostInterface $import_post
*/
do_action( 'w2m_import_missing_post_local_user_id', $error, $wp_post, $import_post );

return;
}

$taxonomies = array();
Expand Down

0 comments on commit 6645f3d

Please sign in to comment.