Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
fbd8d8b3a1
|
@ -216,9 +216,13 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
if($request['collection_id']) {
|
if($request['collection_id']) {
|
||||||
$collection_id = $request['collection_id'];
|
$collection_id = $request['collection_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$query_start = microtime(true);
|
||||||
|
|
||||||
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
|
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
|
||||||
|
|
||||||
|
$query_end = microtime(true);
|
||||||
|
|
||||||
$response = [];
|
$response = [];
|
||||||
|
|
||||||
$return_template = false;
|
$return_template = false;
|
||||||
|
@ -274,6 +278,8 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
|
|
||||||
$rest_response->header('X-WP-Total', (int) $total_items);
|
$rest_response->header('X-WP-Total', (int) $total_items);
|
||||||
$rest_response->header('X-WP-TotalPages', (int) $max_pages);
|
$rest_response->header('X-WP-TotalPages', (int) $max_pages);
|
||||||
|
$rest_response->header('X-Tainacan-Query-Time', $query_end - $query_start);
|
||||||
|
$rest_response->header('X-Tainacan-Elapsed-Time', microtime(true) - $query_start);
|
||||||
|
|
||||||
return $rest_response;
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,8 @@ abstract class Importer {
|
||||||
private $log = [];
|
private $log = [];
|
||||||
|
|
||||||
private $error_log = [];
|
private $error_log = [];
|
||||||
|
|
||||||
|
private $author = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wether to abort importer execution.
|
* Wether to abort importer execution.
|
||||||
|
@ -141,7 +143,9 @@ abstract class Importer {
|
||||||
@session_start();
|
@session_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->id = uniqid();
|
$this->id = uniqid();
|
||||||
|
$this->author = get_current_user_id();
|
||||||
|
|
||||||
$_SESSION['tainacan_importer'][$this->get_id()] = $this;
|
$_SESSION['tainacan_importer'][$this->get_id()] = $this;
|
||||||
|
|
||||||
if (!empty($attributess)) {
|
if (!empty($attributess)) {
|
||||||
|
@ -793,7 +797,7 @@ abstract class Importer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !empty( $itemMetadataArray ) && $collection instanceof Entities\Collection ){
|
if( !empty( $itemMetadataArray ) && $collection instanceof Entities\Collection ){
|
||||||
$item->set_collection( $collection );
|
$item->set_collection( $collection );
|
||||||
|
|
||||||
if( $item->validate() ){
|
if( $item->validate() ){
|
||||||
$insertedItem = $Tainacan_Items->insert( $item );
|
$insertedItem = $Tainacan_Items->insert( $item );
|
||||||
|
@ -866,6 +870,8 @@ abstract class Importer {
|
||||||
$method_name = $steps[$current_step]['callback'];
|
$method_name = $steps[$current_step]['callback'];
|
||||||
|
|
||||||
if (method_exists($this, $method_name)) {
|
if (method_exists($this, $method_name)) {
|
||||||
|
$this->add_log('User in process: ' . $this->author);
|
||||||
|
wp_set_current_user($this->author);
|
||||||
$result = $this->$method_name();
|
$result = $this->$method_name();
|
||||||
} else {
|
} else {
|
||||||
$this->add_error_log( 'Callback not found for step ' . $steps[$current_step]['name']);
|
$this->add_error_log( 'Callback not found for step ' . $steps[$current_step]['name']);
|
||||||
|
|
|
@ -64,6 +64,12 @@ class Old_Tainacan extends Importer{
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function create_taxonomies() {
|
public function create_taxonomies() {
|
||||||
|
|
||||||
|
if(!$this->get_url()){
|
||||||
|
$this->add_error_log('Site url not found');
|
||||||
|
$this->abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->add_log('Creating taxonomies');
|
$this->add_log('Creating taxonomies');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue