sinkronisasi_import.php
888 Bytes
<?php
require("sinkronisasi.include.php");
if (function_exists('drush_main')) {
$do_insert = FALSE;
$do_update = TRUE;
$machine_names = array("jenis_kantor", "kantor");
foreach ($machine_names as $machine_name) {
$vocabulary = taxonomy_vocabulary_machine_name_load($machine_name);
$data = file_get_contents("http://p2humas.intranet.pajak.go.id/adhisimon/sinkronisasi-drupal/" . $machine_name . ".serialized.txt");
if ($do_insert) {
echo "Delete data\n";
delete_all_terms_by_vid($vocabulary->vid);
echo "Insert new data\n";
$terms = unserialize($data);
sinkronisasi_import_iterate_insert($terms);
}
if ($do_update) {
echo "Update data\n";
$terms = unserialize($data);
sinkronisasi_import_iterate_update($terms);
}
}
}