Commit ec2625ff763c53972cc02d8af350ee3e67fea76a
1 parent
ee9a91d5fc
Exists in
master
kembali ke remote file saat import
Showing 1 changed file with 1 additions and 1 deletions Inline Diff
sinkronisasi_import.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | require("sinkronisasi.include.php"); | 3 | require("sinkronisasi.include.php"); |
4 | 4 | ||
5 | if (function_exists('drush_main')) { | 5 | if (function_exists('drush_main')) { |
6 | $do_insert = FALSE; | 6 | $do_insert = FALSE; |
7 | $do_update = TRUE; | 7 | $do_update = TRUE; |
8 | 8 | ||
9 | $machine_names = array("jenis_kantor", "kantor"); | 9 | $machine_names = array("jenis_kantor", "kantor"); |
10 | foreach ($machine_names as $machine_name) { | 10 | foreach ($machine_names as $machine_name) { |
11 | 11 | ||
12 | $vocabulary = taxonomy_vocabulary_machine_name_load($machine_name); | 12 | $vocabulary = taxonomy_vocabulary_machine_name_load($machine_name); |
13 | $data = file_get_contents("adhisimon/sinkronisasi-drupal/" . $machine_name . ".txt"); | 13 | $data = file_get_contents("http://p2humas.intranet.pajak.go.id/adhisimon/sinkronisasi-drupal/" . $machine_name . ".txt"); |
14 | 14 | ||
15 | if ($do_insert) { | 15 | if ($do_insert) { |
16 | echo "Delete data\n"; | 16 | echo "Delete data\n"; |
17 | delete_all_terms_by_vid($vocabulary->vid); | 17 | delete_all_terms_by_vid($vocabulary->vid); |
18 | 18 | ||
19 | echo "Insert new data\n"; | 19 | echo "Insert new data\n"; |
20 | $terms = unserialize($data); | 20 | $terms = unserialize($data); |
21 | sinkronisasi_import_iterate_insert($terms); | 21 | sinkronisasi_import_iterate_insert($terms); |
22 | } | 22 | } |
23 | 23 | ||
24 | if ($do_update) { | 24 | if ($do_update) { |
25 | echo "Update data\n"; | 25 | echo "Update data\n"; |
26 | $terms = unserialize($data); | 26 | $terms = unserialize($data); |
27 | sinkronisasi_import_iterate_update($terms); | 27 | sinkronisasi_import_iterate_update($terms); |
28 | } | 28 | } |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 |