This repository has been archived on 2023-01-23. You can view files and clone it, but cannot push or open issues or pull requests.
importer-parsers-archive-2022/parsers/imdas_pro_sql.php
2023-01-23 15:21:35 +01:00

598 lines
26 KiB
PHP

<?PHP
/**
* Parser for SQL imports from old imdas installations.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @link https://imports.museum-digital.org/parsers/google-arts-and-culture.php
*/
declare(strict_types = 1);
const DB_NAME_IMDAS = 'imdas_dreieich';
/**
* Loads all data from statement.
*
* @param MDMysqliStmt $stmt Statement.
* @param integer $object_id Object ID.
*
* @return array<mixed>
*/
function getAllFromStmt(MDMysqliStmt $stmt, int $object_id):array {
$stmt->bind_param("i", $object_id);
$stmt->execute();
$result = $stmt->do_get_result();
$output = $result->fetch_all(MYSQLI_ASSOC);
$result->close();
return $output;
}
/**
* Parse function.
*
* @param array<mixed> $version Instance to import into.
* @param integer $institution_id Institution to import to.
* @param non-empty-string $XMLFolder Folder of the XML files to import.
* @param string $dataFolder Data folder.
* @param integer $sammlung_id Collection ID. Optional.
* @param boolean $visibility Import objects to be directly visible?.
* @param boolean $insertOnly If set to true, only new objects are added,
* old are not updated.
*
* @return void
*/
function parseImportXML(array $version, int $institution_id, string $XMLFolder, string $dataFolder = "", int $sammlung_id = 0, bool $visibility = false, bool $insertOnly = false) {
if (!is_dir(MD_IMPORTER_CONF::$import_dir_xml . "{$XMLFolder}")) throw new MDFileDoesNotExist("The folder to import from ($XMLFolder) does not exist.");
if (empty($dataFolder)) {
$importImages = false;
}
else $importImages = true;
$ignore = $visibility;
$ignore = $sammlung_id;
// Set up writers
$collectionWriter = new MDCollectionWriter($version['mainDB']);
# $literatureWriter = new MDLiteratureWriter($version['mainDB']);
# $linkWriter = new MDLinkWriter($version['mainDB']);
# $seriesWriter = new MDSeriesWriter($version['mainDB']);
$tagWriter = new MDTagWriter($version['nodaDB']);
$outputHandler = new MDOutputHandler;
$outputHandler->setVerbosity(2);
$objectWriter = new MDObjectWriter($version['mainDB'], $version['nodaDB'], $version['link'], $version['filepath'], $version['dataFolderLink']);
/*
$objectWriter->disableImportAdditionalData = true;
$objectWriter->disableUpdateBaseData = true;
$objectWriter->disableImportCollections = true;
$objectWriter->disableImportEvents = true;
$objectWriter->disableImportTags = true;
$objectWriter->disableImportLiterature = true;
$objectWriter->disableImportHyperlinks = true;
// $objectWriter->disableImportSeries = true;
$objectWriter->disableImportImagesResources = true;
$objectWriter->disableImportObjectRecords = true;
$objectWriter->disableImportTranscriptions = true;
$objectWriter->disableImportMarkings = true;
$objectWriter->disableImportExhibitions = true;
$objectWriter->disableImportReception = true;
$objectWriter->importObjectTypeAsTag = true;
*/
$mysqli = $version['mainDB'];
// Set up prepared statement for checking if a tag of a given name exists
$tagNameExistsStmt = $version['nodaDB']->do_prepare("SELECT `tag_id`
FROM `tag`
WHERE `tag_name` = ?
LIMIT 1");
$objResult = $mysqli->do_read_query("SELECT *,
`language`.`code` AS `lang_code`,
`res_type`.`name` AS `res_type_name`
FROM `" . DB_NAME_IMDAS . "`.`object`
LEFT JOIN `" . DB_NAME_IMDAS . "`.`real_obj`
ON `object`.`object_id` = `real_obj`.`object_id`
LEFT JOIN `" . DB_NAME_IMDAS . "`.`res_type`
ON `object`.`res_type_id` = `res_type`.`res_type_id`
LEFT JOIN `" . DB_NAME_IMDAS . "`.`coin_main`
ON `object`.`object_id` = `coin_main`.`object_id`
LEFT JOIN `" . DB_NAME_IMDAS . "`.`media_obj`
ON `object`.`object_id` = `media_obj`.`object_id`
LEFT JOIN `" . DB_NAME_IMDAS . "`.`language`
ON `object`.`language_id` = `language`.`language_id`
LEFT JOIN `" . DB_NAME_IMDAS . "`.`coll_obj`
ON `object`.`object_id` = `coll_obj`.`object_id`
");
$colorStmt = $mysqli->do_prepare("SELECT `color_name`, `obj_part`.`name` AS `part_name`
FROM `" . DB_NAME_IMDAS . "`.`color_type`, `" . DB_NAME_IMDAS . "`.`obj_color`,
`" . DB_NAME_IMDAS . "`.`obj_part`
WHERE `object_id` = ?
AND `obj_color`.`color_type_id` = `color_type`.`color_type_id`
AND `obj_color`.`part_id` = `obj_part`.`part_id`");
$collectionStmt = $mysqli->do_prepare("SELECT *
FROM `" . DB_NAME_IMDAS . "`.`collection`
WHERE `collection_id` = ?");
$specialsStmt = $mysqli->do_prepare("SELECT *
FROM `" . DB_NAME_IMDAS . "`.`obj_specials`
WHERE `object_id` = ?");
$tagsStmt = $mysqli->do_prepare("SELECT *
FROM `" . DB_NAME_IMDAS . "`.`term_obj`, `" . DB_NAME_IMDAS . "`.`thes_rel`
WHERE `object_id` = ?
AND `thes_rel`.`thes_rel_id` = `term_obj`.`thes_rel_id`");
/*
$vtrStmt = $mysqli->do_prepare("SELECT *
FROM `" . DB_NAME_IMDAS . "`.`vtr`, `" . DB_NAME_IMDAS . "`.`vtr_term`
WHERE `object_id` = ?
AND `vtr_term`.`term_id` = `vtr`.`term_id`");
*/
$measurementsStmt = $mysqli->do_prepare("SELECT `obj_value`, `unit`.`name` AS `unit_name`, `value_type`.`name`
FROM `" . DB_NAME_IMDAS . "`.`obj_value`, `" . DB_NAME_IMDAS . "`.`value_type`, `" . DB_NAME_IMDAS . "`.`unit`
WHERE `object_id` = ?
AND `obj_value`.`value_type_id` = `value_type`.`value_type_id`
AND `obj_value`.`unit_id` = `unit`.`unit_id`");
$objNumStmt = $mysqli->do_prepare("SELECT `note`, `obj_num`.`num`, `obj_num_type`.`name` AS `type_name`
FROM `" . DB_NAME_IMDAS . "`.`obj_num`, `" . DB_NAME_IMDAS . "`.`obj_num_type`
WHERE `object_id` = ?
AND `obj_num`.`num_type_id` = `obj_num_type`.`num_type_id`");
$entryStmt = $mysqli->do_prepare("SELECT *
FROM `" . DB_NAME_IMDAS . "`.`regist_hist`, `" . DB_NAME_IMDAS . "`.`regist_type`
WHERE `object_id` = ?
AND `regist_hist`.`regist_type_id` = `regist_type`.`regist_type_id`");
$inscriptionStmt = $mysqli->do_prepare("SELECT `inscription`, `obj_part`.`name` AS `part_name`
FROM `" . DB_NAME_IMDAS . "`.`obj_inscr`, `" . DB_NAME_IMDAS . "`.`obj_part`
WHERE `object_id` = ?
AND `obj_inscr`.`part_id` = `obj_part`.`part_id`");
$locationStmt = $mysqli->do_prepare("SELECT *
FROM `" . DB_NAME_IMDAS . "`.`obj_loc_new`, `" . DB_NAME_IMDAS . "`.`location`
WHERE `object_id` = ?
AND `obj_loc_new`.`location_id` = `location`.`location_id`");
$personStmt = $mysqli->do_prepare("SELECT `role`.`name` AS `role_name`,
`person`.*, `obj_pers_role`.`note`
FROM `" . DB_NAME_IMDAS . "`.`obj_pers_role`, `" . DB_NAME_IMDAS . "`.`role`, `" . DB_NAME_IMDAS . "`.`person`
WHERE `object_id` = ?
AND `obj_pers_role`.`person_id` = `person`.`person_id`
AND `obj_pers_role`.`role_id` = `role`.`role_id`");
$placeStmt = $mysqli->do_prepare("SELECT `place_type`.`name` AS `type_name`, `obj_place`.`note`, `thes_rel`.`name` AS `place_name`
FROM `" . DB_NAME_IMDAS . "`.`obj_place`, `" . DB_NAME_IMDAS . "`.`place_type`, `" . DB_NAME_IMDAS . "`.`thes_rel`
WHERE `object_id` = ?
AND `obj_place`.`place_type_id` = `place_type`.`place_type_id`
AND `obj_place`.`thes_rel_id` = `thes_rel`.`thes_rel_id`");
echo "HI";
while ($objectData = $objResult->fetch_assoc()) {
$outputHandler->toLog("Reading object " . $objectData['object_id'], 2);
if (empty($objectData['object_id'])) continue;
$object_id = $objectData['object_id'];
$objectData['color'] = getAllFromStmt($colorStmt, $object_id);
$objectData['collection'] = getAllFromStmt($collectionStmt, $object_id);
$objectData['specials'] = getAllFromStmt($specialsStmt, $object_id);
$objectData['tags'] = getAllFromStmt($tagsStmt, $object_id);
// $objectData['vtr'] = getAllFromStmt($vtrStmt, $object_id);
$objectData['measurements'] = getAllFromStmt($measurementsStmt, $object_id);
$objectData['objNum'] = getAllFromStmt($objNumStmt, $object_id);
$objectData['entryHist'] = getAllFromStmt($entryStmt, $object_id);
$objectData['inscription'] = getAllFromStmt($inscriptionStmt, $object_id);
$objectData['location'] = getAllFromStmt($locationStmt, $object_id);
$objectData['person'] = getAllFromStmt($personStmt, $object_id);
$objectData['place'] = getAllFromStmt($placeStmt, $object_id);
// Remove unwanted data
foreach ($objectData as $key => $value) {
if (empty($value)) {
unset($objectData[$key]);
continue;
}
if (is_array($value)) {
foreach ($value as $innerKey => $innerValue) {
foreach ($innerValue as $innerInnerKey => $innerInnerValue) {
if ($innerInnerValue === null || $innerInnerValue === '') {
unset($objectData[$key][$innerKey][$innerInnerKey]);
}
}
}
if (empty($objectData[$key])) unset($objectData[$key]);
}
}
// Remove unwanted values
unset($objectData['regist_num_serial'],
$objectData['import_id'],
$objectData['updatevtr'],
$objectData['invent_jn'],
$objectData['publikum'],
$objectData['updateobjsort'],
$objectData['default_coll'],
$objectData['media_type_id'],
$objectData['invalid'],
$objectData['ser_num'],
$objectData['language_id'],
$objectData['sort_regist_num'],
$objectData['obj_status_id'],
$objectData['elimination'],
$objectData['name'],
$objectData['code'],
$objectData['res_type_id'],
$objectData['regist_type_id'],
$objectData['photographer_id'],
$objectData['owner_original_id'],
$objectData['collection_id'],
$objectData['sort_local_num'],
$objectData['regist_str'],
);
// Parse
if (empty($objectData)) continue;
if (!empty($objectData['regist_num'])) {
$invNo = $objectData['regist_num'];
}
else {
$invNo = $objectData['object_id'];
}
$object = new MDObject($version['mainDB'], $version['nodaDB'], $version['language'], $institution_id, $invNo, $objectData["res_type_name"], $objectData["title"] ?? $invNo, $objectData["description"] ?? $objectData['short_descr'] ?? '-', $outputHandler);
unset($objectData['regist_num'], $objectData['object_id'], $objectData['title'],
$objectData['res_type_name'], $objectData['description']);
if (!empty($objectData['regist_date'])) {
$object->set_string("ersterfasst_zeitpunkt", (string)$objectData['regist_date']);
}
if (!empty($objectData['obj_history'])) {
$object->set_string("objektgeschichte", (string)$objectData['obj_history']);
}
unset($objectData['obj_history']);
if (!empty($objectData['current_loc'])) {
$object->set_string("standort_aktuell", (string)$objectData['current_loc']);
}
unset($objectData['current_loc']);
if (!empty($objectData['condition'])) {
$object->set_string("restaurierung", (string)$objectData['condition']);
}
unset($objectData['condition']);
if (!empty($objectData['num_pieces'])) {
$object->set_string("stueckzahl", (string)$objectData['num_pieces']);
}
unset($objectData['num_pieces']);
if (!empty($objectData['inscription'])) {
foreach ($objectData['inscription'] as $inscription) {
$object->append_string("beschriftung2", PHP_EOL . ($inscription['part_name'] ?? '') . ': ' . $inscription['inscription'] . PHP_EOL);
}
}
unset($objectData['inscription']);
if (!empty($objectData['lang_code'])) {
if (isset(MDLanguagesSet::AVAILABLE_LANGUAGES[$objectData['lang_code']])) {
$object->set_string("content_language", $objectData['lang_code']);
}
}
unset($objectData['lang_code']);
// Images in the museum
$imgFields = [
'studio',
'rights',
'statu_o_cons',
];
foreach ($imgFields as $fieldName) {
if (!empty($objectData[$fieldName])) {
$object->append_string("bilder_lokal", PHP_EOL . $fieldName . ' (imdas): ' . $objectData[$fieldName]);
}
unset($objectData[$fieldName]);
}
// Notes
$notesFields = [
'regist_num_year',
'lastdate',
'inv_date',
'guid',
'newdate',
'rec_date',
'altbestand',
'regist_date',
'negative_number',
'positive_number',
'local_num_text',
'local_number',
'remarks',
'reservation',
'short_descr',
'local_sub_number',
];
foreach ($notesFields as $fieldName) {
if (!empty($objectData[$fieldName])) {
$object->append_string("notizen_text1", PHP_EOL . $fieldName . ' (imdas): ' . $objectData[$fieldName]);
}
unset($objectData[$fieldName]);
}
if (!empty($objectData['color'])) {
foreach ($objectData['color'] as $tEntry) {
$object->append_string("notizen_text1", PHP_EOL . implode(': ', $tEntry) . PHP_EOL);
}
}
unset($objectData['color']);
if (!empty($objectData['collection'])) {
foreach ($objectData['collection'] as $tCollection) {
$object->appendCollectionByName($tCollection['name'], "ID: " . $tCollection['collection_id'] . PHP_EOL . 'Registriert: ' . $tCollection['lastdate'], $collectionWriter);
}
}
unset($objectData['collection']);
if (!empty($objectData['tags'])) {
foreach ($objectData['tags'] as $tEntry) {
if (empty($tEntry['name'])) continue;
$object->appendTagByName($tEntry['name'], "", $tagWriter);
}
}
unset($objectData['tags']);
if (!empty($objectData['place'])) {
foreach ($objectData['place'] as $tEntry) {
if (empty($tEntry['place_name'])) continue;
if (empty(MDConcPlace::PLACE_ROLES_TO_EVENT_TYPE[$tEntry['type_name']])) {
throw new Exception("Unknown place type: " . $tEntry['type_name']);
}
$event = new MDEvent($version['mainDB'], $version['nodaDB'], $version['language'], MDConcPlace::PLACE_ROLES_TO_EVENT_TYPE[$tEntry['type_name']], $outputHandler);
$event->set_orte_id($tEntry['place_name']);
if (!empty($tEntry['note'])) {
$event->set_ereignis_anmerkung($tEntry['note']);
}
if ($event->get_orte_id() !== 0) $object->appendEvent($event);
}
}
unset($objectData['place']);
if (!empty($objectData['location'])) {
foreach ($objectData['location'] as $tEntry) {
$object->append_string("standort_eigentlich", ' - ' . $tEntry['name'] . ' (' . $tEntry['abbreviation'] . '): ' . ($tEntry['description'] ?? ''));
}
}
unset($objectData['location']);
if (!empty($objectData['objNum'])) {
foreach ($objectData['objNum'] as $tEntry) {
$object->append_string("bilder_lokal", PHP_EOL . $tEntry['type_name'] . ': ' . $tEntry['num']);
}
}
unset($objectData['objNum']);
if (!empty($objectData['entryHist'])) {
foreach ($objectData['entryHist'] as $tEntry) {
if (!empty($tEntry['name'])) $object->set_entry_type("zugang_art", $tEntry['name']);
if (!empty($tEntry['regist_hist'])) $object->set_string("zeitpunkt_zugang", $tEntry['regist_hist']);
}
}
unset($objectData['entryHist']);
if (!empty($objectData['specials'])) {
foreach ($objectData['specials'] as $tKey => $tEntry) {
unset($tEntry['object_id'], $tEntry['lastdate'], $tEntry['lastuser']);
foreach ($tEntry as $innerKey => $innerValue) {
if (empty($innerValue) || $innerValue == '0.0000') {
unset($tEntry[$innerKey]);
}
}
if (!empty($tEntry['dating_abs_hist'])) {
$event = new MDEvent($version['mainDB'], $version['nodaDB'], $version['language'], 1, $outputHandler);
$event->set_zeiten_id($tEntry['dating_abs_hist']);
if ($event->get_zeiten_id() !== 0) $object->appendEvent($event);
}
unset($tEntry['dating_abs_hist']);
if (empty($tEntry)) {
unset($objectData['specials'][$tKey]);
}
}
if (empty($objectData['specials'])) {
unset($objectData['specials']);
}
}
if (!empty($objectData['person'])) {
foreach ($objectData['person'] as $tKey => $tEntry) {
if ($tEntry['role_name'] === 'Voreigentümer') {
$object->set_string("vorbesitzer", $tEntry['letter_addr'] ?? "" . ' ' . $tEntry['first_name'] ?? "" . ' ' . $tEntry['surename'] ?? "" . ' ');
unset($objectData['person'][$tKey]);
continue;
}
else if ($tEntry['role_name'] === 'Übernehmer') {
$object->append_string("notizen_text1", PHP_EOL . "Überbringer" . $tEntry['letter_addr'] ?? "" . ' ' . $tEntry['first_name'] ?? "" . ' ' . $tEntry['surename'] ?? "" . ' ' . PHP_EOL);
unset($objectData['person'][$tKey]);
continue;
}
else if ($tEntry['role_name'] === 'Überbringer') {
$object->append_string("notizen_text1", PHP_EOL . "Überbringer" . $tEntry['letter_addr'] ?? "" . ' ' . $tEntry['first_name'] ?? "" . ' ' . $tEntry['surename'] ?? "" . ' ' . PHP_EOL);
unset($objectData['person'][$tKey]);
continue;
}
else if ($tEntry['role_name'] === 'Hersteller') {
$event = new MDEvent($version['mainDB'], $version['nodaDB'], $version['language'], 1, $outputHandler);
$event->set_persinst_id($tEntry['letter_addr'] ?? "" . ' ' . $tEntry['first_name'] ?? "" . ' ' . $tEntry['surename']);
if (!empty($tEntry['note'])) {
$event->set_ereignis_anmerkung($tEntry['note']);
}
if ($event->get_persinst_id() !== 0) $object->appendEvent($event);
unset($objectData['person'][$tKey]);
continue;
}
}
if (empty($objectData['person'])) unset($objectData['person']);
}
if (!empty($objectData['measurements'])) {
foreach ($objectData['measurements'] as $tKey => $tEntry) {
if (in_array($tEntry['name'], ['Schätzpreis 2005', 'Schätzpreis 2001', 'Schätzpreis 2004', 'Schätzpreis 2006', 'Schätzpreis 2003', 'Schätzpreis 2002', 'Schätzpreis 2007', 'Schätzpreis 1999', 'Schätzpreis 1998', 'Schätzpreis 1997', 'Bewertung', 'Schätzpreis 2008', 'Schätzpreis 2009'], true)) {
$object->set_currency("wert_art", $tEntry['unit_name']);
$object->set_string("wert_zahl", (string)$tEntry['obj_value']);
$object->append_string("notizen_text1", PHP_EOL . $tEntry['name'] . ': ' . $tEntry['obj_value'] . ' ' . $tEntry['unit_name']);
unset($objectData['measurements'][$tKey]);
continue;
}
if (in_array($tEntry['name'], ['Kaufpreis'], true)) {
$object->set_currency("geld_art", $tEntry['unit_name']);
$object->set_string("ankaufsumme", (string)$tEntry['obj_value']);
$object->append_string("notizen_text1", PHP_EOL . $tEntry['name'] . ': ' . $tEntry['obj_value'] . ' ' . $tEntry['unit_name']);
unset($objectData['measurements'][$tKey]);
continue;
}
else if (in_array($tEntry['name'], ['Höhe', 'Größe'], true)) {
try {
$object->set_length_unit("mass2_hoehe_einheit", $tEntry['unit_name']);
}
catch (MDInvalidLengthUnit $e) {
}
$object->set_string("mass2_hoehe_wert", (string)$tEntry['obj_value']);
unset($objectData['measurements'][$tKey]);
continue;
}
else if (in_array($tEntry['name'], ['Tiefe', 'Länge'], true)) {
try {
$object->set_length_unit("mass2_laenge_einheit", $tEntry['unit_name']);
}
catch (MDInvalidLengthUnit $e) {
}
$object->set_string("mass2_laenge_wert", (string)$tEntry['obj_value']);
unset($objectData['measurements'][$tKey]);
continue;
}
else if (in_array($tEntry['name'], ['Breite', 'Dicke'], true)) {
try {
$object->set_length_unit("mass2_breite_einheit", $tEntry['unit_name']);
}
catch (MDInvalidLengthUnit $e) {
}
$object->set_string("mass2_breite_wert", (string)$tEntry['obj_value']);
unset($objectData['measurements'][$tKey]);
continue;
}
else if (in_array($tEntry['name'], ['Gewicht'], true)) {
try {
$object->set_weight_unit("mass2_gewicht_einheit", $tEntry['unit_name']);
}
catch (MDInvalidWeightUnit $e) {
}
$object->set_string("mass2_gewicht_wert", (string)$tEntry['obj_value']);
unset($objectData['measurements'][$tKey]);
continue;
}
else if (in_array($tEntry['name'], ['Durchmesser', 'größter Durchmesser', 'Außenmaß (Durchmesser)'], true)) {
try {
$object->set_length_unit("mass2_durchmesser_einheit", $tEntry['unit_name']);
}
catch (MDInvalidLengthUnit $e) {
}
$object->set_string("mass2_durchmesser_wert", (string)$tEntry['obj_value']);
unset($objectData['measurements'][$tKey]);
continue;
}
else if (in_array($tEntry['name'], ['innen', 'Umfang', 'Hängehöhe', 'Ringmaß'], true)) {
$object->append_string("notizen_text1", PHP_EOL . $tEntry['name'] . ': ' . $tEntry['unit_name'] . ', ' . $tEntry['obj_value']);
unset($objectData['measurements'][$tKey]);
continue;
}
}
if (empty($objectData['measurements'])) unset($objectData['measurements']);
}
/*
if (isset($objectData['Standort'])) {
$object->set_string("standort_eigentlich", $objectData['Standort'] . ' / ' . $objectData['Zusatz']);
unset($objectData['Standort'], $objectData['Zusatz']);
}
// Object base data
$object = new MDObject($version['mainDB'], $version['nodaDB'], $version['language'], $institution_id, $objectData['Inventarnummer'], $objectData["Objektbezeichnung"], $objectData["Titel"] ?: $objectData['Inventarnummer'], $objectData["Bemerkung"], $outputHandler);
unset($objectData['Inventarnummer'], $objectData["Objektbezeichnung"], $objectData["Titel"], $objectData["Bemerkung"]);
$object->set_objekt_publik($visibility);
if (isset($objectData['Breite'])) {
$object->set_string("mass2_breite_wert", $objectData['Breite']);
$object->set_length_unit("mass2_breite_einheit", $objectData['Maßeinheit']);
unset($objectData['Breite'], $objectData['Maßeinheit']);
}
if (isset($objectData['Höhe'])) {
$object->set_string("mass2_hoehe_wert", $objectData['Höhe']);
$object->set_length_unit("mass2_hoehe_einheit", $objectData['Maßeinheit2']);
unset($objectData['Höhe'], $objectData['Maßeinheit2']);
}
if (isset($objectData['Standort'])) {
$object->set_string("standort_eigentlich", $objectData['Standort']);
unset($objectData['Standort']);
}
unset($objectData['Objektart']);
$object->appendSeriesByName("Schultafeln", "Schultafeln", $seriesWriter);
*/
if (!empty($objectData)) {
throw new MDParserIncomplete(var_export($objectData, true));
}
$newObjectID = $objectWriter->writeObject($object, true, $insertOnly, $outputHandler);
$this->outputHandler->toLog("Imported to object #" . $newObjectID, MDConsoleStatus::UPDATE);
// Sleep for a millisecond
usleep(IMPORTER_DELAY_PER_OBJECT);
}
$tagNameExistsStmt->close();
unset($tagNameExistsStmt);
}