tainacan legacy importer - handle compound metadata

This commit is contained in:
eduardohumberto 2018-09-06 21:46:05 -03:00
parent 7aab768b6d
commit 7f44540240
2 changed files with 12 additions and 2 deletions

View File

@ -688,7 +688,12 @@ abstract class Importer {
$this->add_log('Processing item ' . $current_collection_item); $this->add_log('Processing item ' . $current_collection_item);
$processed_item = $this->process_item( $current_collection_item, $collection_definition ); $processed_item = $this->process_item( $current_collection_item, $collection_definition );
if( $processed_item) { if( $processed_item ) {
if( is_bool($processed_item) ){
return $this->next_item();
}
$this->add_log('Inserting item ' . $current_collection_item); $this->add_log('Inserting item ' . $current_collection_item);
$this->insert( $processed_item, $current_collection ); $this->insert( $processed_item, $current_collection );
} else { } else {

View File

@ -239,6 +239,11 @@ class Old_Tainacan extends Importer{
$info = json_decode($info['body']); $info = json_decode($info['body']);
if( !isset( $info->items ) ){ if( !isset( $info->items ) ){
if( isset($info->code) && $info->code === 'empty_search' ){
return true;
}
$this->add_error_log('Error in fetch remote (' . $url_to_fetch . ')'); $this->add_error_log('Error in fetch remote (' . $url_to_fetch . ')');
$this->abort(); $this->abort();
return false; return false;
@ -709,7 +714,7 @@ class Old_Tainacan extends Importer{
if( isset( $meta->metadata->children ) ){ if( isset( $meta->metadata->children ) ){
foreach( $meta->metadata->children as $child ){ foreach( $meta->metadata->children as $child ){
$this->create_metadata( $node_metadata_old, $collection_id); $this->create_metadata( $child, $collection_id);
} }
} }