Alter importer class name and start parser method
This commit is contained in:
parent
ef30e48d39
commit
5ca7e732e4
|
@ -52,6 +52,15 @@ class Importer_Handler {
|
|||
'manual_mapping' => false,
|
||||
]);
|
||||
|
||||
// $this->register_importer([
|
||||
// 'name' => 'OAI PMH',
|
||||
// 'description' => __('Import structure from a OAI PMH repository', 'tainacan'),
|
||||
// 'slug' => 'oaipmh_importer',
|
||||
// 'class_name' => '\Tainacan\Importer\Oaipmh_Importer',
|
||||
// 'manual_collection' => false,
|
||||
// 'manual_mapping' => false,
|
||||
// ]);
|
||||
|
||||
do_action('tainacan_register_importers');
|
||||
|
||||
add_action( 'tainacan-enqueue-admin-scripts', array($this, 'enqueue_scripts') );
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace Tainacan\Importer;
|
|||
use Tainacan;
|
||||
use Tainacan\Entities;
|
||||
|
||||
class Oaipmh extends Importer {
|
||||
class Oaipmh_Importer extends Importer {
|
||||
|
||||
protected $steps = [
|
||||
[
|
||||
|
@ -15,7 +15,7 @@ class Oaipmh extends Importer {
|
|||
'name' => 'Import Items',
|
||||
'progress_label' => 'Import Items',
|
||||
'callback' => 'process_collections'
|
||||
],
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
|
@ -49,6 +49,27 @@ class Oaipmh extends Importer {
|
|||
|
||||
//private functions
|
||||
|
||||
/**
|
||||
* decode request from wp_remote
|
||||
* @return array/bool
|
||||
*/
|
||||
protected function decode_request($result, $url){
|
||||
if (is_wp_error($result)) {
|
||||
|
||||
$this->add_error_log($result->get_error_message());
|
||||
$this->add_error_log('Error in fetch remote' . $url);
|
||||
$this->abort();
|
||||
return false;
|
||||
|
||||
} else if (isset($result['body'])){
|
||||
// TODO: parse body
|
||||
}
|
||||
|
||||
$this->add_error_log('Error in fetch remote');
|
||||
$this->abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* executes the request
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue