Commit ef856c566af223d11f8c87091e3bf185695d6ba3

Authored by Adhidarma Hadiwinoto
1 parent 5a0c3f2f9f
Exists in master

import jenis_kantor dan kantor

Showing 1 changed file with 13 additions and 11 deletions Side-by-side Diff

sinkronisasi_import.php
... ... @@ -3,20 +3,22 @@
3 3 require("sinkronisasi.include.php");
4 4  
5 5 if (function_exists('drush_main')) {
6   - $machine_name = "jenis_kantor";
  6 + $machine_names = array("jenis_kantor", "kantor");
  7 + foreach ($machine_names as $machine_name) {
7 8  
8   - $vocabulary = taxonomy_vocabulary_machine_name_load($machine_name);
  9 + $vocabulary = taxonomy_vocabulary_machine_name_load($machine_name);
9 10  
10   - echo "Delete data\n";
11   - delete_all_terms_by_vid($vocabulary->vid);
  11 + echo "Delete data\n";
  12 + delete_all_terms_by_vid($vocabulary->vid);
12 13  
13   - $data = file_get_contents("adhisimon/sinkronisasi-drupal/" . $machine_name . ".txt");
  14 + $data = file_get_contents("adhisimon/sinkronisasi-drupal/" . $machine_name . ".txt");
14 15  
15   - echo "Insert new data\n";
16   - $terms = unserialize($data);
17   - sinkronisasi_import_iterate_insert($terms);
  16 + echo "Insert new data\n";
  17 + $terms = unserialize($data);
  18 + sinkronisasi_import_iterate_insert($terms);
18 19  
19   - echo "Update data\n";
20   - $terms = unserialize($data);
21   - sinkronisasi_import_iterate_update($terms);
  20 + echo "Update data\n";
  21 + $terms = unserialize($data);
  22 + sinkronisasi_import_iterate_update($terms);
  23 + }
22 24 }