From a4f24e5478367bb532a79ef32bff3ef030859910 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Wed, 26 May 2021 17:12:15 +0200 Subject: [PATCH] Add logging of synchronization with wikidata --- src/NodaWikidataFetcher.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/NodaWikidataFetcher.php b/src/NodaWikidataFetcher.php index 9c7c0ec..bfe950a 100644 --- a/src/NodaWikidataFetcher.php +++ b/src/NodaWikidataFetcher.php @@ -422,10 +422,12 @@ final class NodaWikidataFetcher { SET `persinst_kurzinfo` = ? WHERE `persinst_id` = ?"); - if ($cergebnis->num_rows === 0) exit; + if ($cergebnis->num_rows === 0) { + throw new Exception("There is no actor of ID #" . $persinst_id); + } $cinfo = $cergebnis->fetch_assoc(); - if (!empty($cinfo['persinst_kurzinfo']) and substr($cinfo['persinst_kurzinfo'], 0, 3) != 'GND') { + if (!empty($cinfo['persinst_kurzinfo']) and substr($cinfo['persinst_kurzinfo'], 0, 3) !== 'GND') { if (isset($_GET['keep'])) { if (!($_GET['keep']) || $_GET['keep'] === 'replace') { @@ -711,6 +713,8 @@ final class NodaWikidataFetcher { $this->getWikidataTranslationsForPersinst($data, $persinst_id); + NodaLogEdit::logPersinstEdit($this->_mysqli_noda, $persinst_id, "wikidata-fetcher", $erfasst_von, 'update', 'synchronize'); + } /** @@ -1110,6 +1114,8 @@ final class NodaWikidataFetcher { $this->getWikidataTranslationsForPlace($data, $onum); + NodaLogEdit::logPlaceEdit($this->_mysqli_noda, $onum, "wikidata-fetcher", $erfasst_von, 'update', 'synchronize'); + } /** @@ -1431,6 +1437,8 @@ final class NodaWikidataFetcher { // Get translations if (!empty($data)) $this->getWikidataTranslationsForTag($data, $tag_id); + NodaLogEdit::logTagEdit($this->_mysqli_noda, $tag_id, "wikidata-fetcher", $erfasst_von, 'update', 'synchronize'); + } /**