Old Tainacan importer: Categories - adding old tainacan category ID
This commit is contained in:
parent
261f1203bf
commit
e79f154a7d
|
@ -92,6 +92,10 @@ class Old_Tainacan extends Importer
|
||||||
$Tainacan_Taxonomies->insert($taxonomy);
|
$Tainacan_Taxonomies->insert($taxonomy);
|
||||||
|
|
||||||
$inserted_taxonomy = $Tainacan_Taxonomies->fetch($taxonomy->get_id());
|
$inserted_taxonomy = $Tainacan_Taxonomies->fetch($taxonomy->get_id());
|
||||||
|
|
||||||
|
/*Insert old tainacan id*/
|
||||||
|
add_post_meta($inserted_taxonomy->get_id(), 'old_tainacan_category_id', $category->term_id);
|
||||||
|
|
||||||
if(isset($category->children) && $inserted_taxonomy)
|
if(isset($category->children) && $inserted_taxonomy)
|
||||||
{
|
{
|
||||||
$this->add_all_terms($inserted_taxonomy, $category->children);
|
$this->add_all_terms($inserted_taxonomy, $category->children);
|
||||||
|
@ -122,6 +126,9 @@ class Old_Tainacan extends Importer
|
||||||
|
|
||||||
$inserted_term = $Tainacan_Terms->insert($new_term);
|
$inserted_term = $Tainacan_Terms->insert($new_term);
|
||||||
|
|
||||||
|
/*Insert old tainacan id*/
|
||||||
|
add_term_meta($inserted_term->get_id(), 'old_tainacan_category_id', $term->term_id );
|
||||||
|
|
||||||
if(isset($term->children))
|
if(isset($term->children))
|
||||||
{
|
{
|
||||||
$this->add_all_terms($taxonomy_father, $term->children, $inserted_term);
|
$this->add_all_terms($taxonomy_father, $term->children, $inserted_term);
|
||||||
|
|
|
@ -49,6 +49,7 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
||||||
$_SESSION['tainacan_importer'][$id]->set_url($url);
|
$_SESSION['tainacan_importer'][$id]->set_url($url);
|
||||||
|
|
||||||
$_SESSION['tainacan_importer'][$id]->run();
|
$_SESSION['tainacan_importer'][$id]->run();
|
||||||
|
$this->assertTrue(true);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*public function test_file_old_tainacan () {
|
/*public function test_file_old_tainacan () {
|
||||||
|
@ -242,7 +243,7 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
||||||
public function test_fetch_file(){
|
public function test_fetch_file(){
|
||||||
$csv_importer = new Importer\CSV();
|
$csv_importer = new Importer\CSV();
|
||||||
$id = $csv_importer->get_id();
|
$id = $csv_importer->get_id();
|
||||||
/*$_SESSION['tainacan_importer'][$id]->fetch_from_remote( 'http://localhost/wordpress-test/wp-json' );
|
$_SESSION['tainacan_importer'][$id]->fetch_from_remote( 'http://localhost/wordpress-test/wp-json' );
|
||||||
$this->assertTrue( isset( $_SESSION['tainacan_importer'][$id]->tmp_file ) );*/
|
$this->assertTrue( isset( $_SESSION['tainacan_importer'][$id]->tmp_file ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue