Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
fbd8d8b3a1
|
@ -217,8 +217,12 @@ class REST_Items_Controller extends REST_Controller {
|
|||
$collection_id = $request['collection_id'];
|
||||
}
|
||||
|
||||
$query_start = microtime(true);
|
||||
|
||||
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
|
||||
|
||||
$query_end = microtime(true);
|
||||
|
||||
$response = [];
|
||||
|
||||
$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-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;
|
||||
}
|
||||
|
|
|
@ -113,6 +113,8 @@ abstract class Importer {
|
|||
|
||||
private $error_log = [];
|
||||
|
||||
private $author = 0;
|
||||
|
||||
/**
|
||||
* Wether to abort importer execution.
|
||||
* @var bool
|
||||
|
@ -142,6 +144,8 @@ abstract class Importer {
|
|||
}
|
||||
|
||||
$this->id = uniqid();
|
||||
$this->author = get_current_user_id();
|
||||
|
||||
$_SESSION['tainacan_importer'][$this->get_id()] = $this;
|
||||
|
||||
if (!empty($attributess)) {
|
||||
|
@ -866,6 +870,8 @@ abstract class Importer {
|
|||
$method_name = $steps[$current_step]['callback'];
|
||||
|
||||
if (method_exists($this, $method_name)) {
|
||||
$this->add_log('User in process: ' . $this->author);
|
||||
wp_set_current_user($this->author);
|
||||
$result = $this->$method_name();
|
||||
} else {
|
||||
$this->add_error_log( 'Callback not found for step ' . $steps[$current_step]['name']);
|
||||
|
|
|
@ -65,6 +65,12 @@ class Old_Tainacan extends Importer{
|
|||
*/
|
||||
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');
|
||||
|
||||
foreach ($this->get_taxonomies() as $taxonomy) {
|
||||
|
|
Loading…
Reference in New Issue