Remove superfluous variable assignments

This commit is contained in:
Joshua Ramon Enslin 2022-09-15 21:29:07 +02:00
parent 7c0ad9fa37
commit 5819caff91
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
12 changed files with 44 additions and 134 deletions

View File

@ -66,7 +66,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$persinstRewriteResult->close(); $persinstRewriteResult->close();
$persinstRewriteResult = null;
return $output; return $output;
@ -98,7 +97,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$persinstByTLNameResult->close(); $persinstByTLNameResult->close();
$persinstByTLNameResult = null;
return $output; return $output;
@ -130,7 +128,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$persinstByBaseNameResult->close(); $persinstByBaseNameResult->close();
$persinstByBaseNameResult = null;
return $output; return $output;
@ -162,7 +159,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$result->close(); $result->close();
$result = null;
return $output; return $output;
@ -199,7 +195,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$persinstByImportLogResult->close(); $persinstByImportLogResult->close();
$persinstByImportLogResult = null;
return $output; return $output;
@ -260,7 +255,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$placeRewriteResult->close(); $placeRewriteResult->close();
$placeRewriteResult = null;
return $output; return $output;
@ -290,7 +284,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$placeByBaseNameResult->close(); $placeByBaseNameResult->close();
$placeByBaseNameResult = null;
return $output; return $output;
@ -322,7 +315,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$placeByTLNameResult->close(); $placeByTLNameResult->close();
$placeByTLNameResult = null;
return $output; return $output;
@ -354,7 +346,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$placeByNodaResult->close(); $placeByNodaResult->close();
$placeByNodaResult = null;
return $output; return $output;
@ -388,7 +379,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$placeByImportLogResult->close(); $placeByImportLogResult->close();
$placeByImportLogResult = null;
return $output; return $output;
@ -449,7 +439,6 @@ final class NodaIDGetter {
} }
$tagRewriteResult->close(); $tagRewriteResult->close();
$tagRewriteResult = null;
return $output; return $output;
@ -479,7 +468,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$tagByBaseNameResult->close(); $tagByBaseNameResult->close();
$tagByBaseNameResult = null;
return $output; return $output;
@ -511,7 +499,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$tagByTLNameResult->close(); $tagByTLNameResult->close();
$tagByTLNameResult = null;
return $output; return $output;
@ -543,7 +530,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$tagByNodaResult->close(); $tagByNodaResult->close();
$tagByNodaResult = null;
return $output; return $output;
@ -577,7 +563,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$tagByImportLogResult->close(); $tagByImportLogResult->close();
$tagByImportLogResult = null;
return $output; return $output;
@ -636,7 +621,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$timeByBaseNameResult->close(); $timeByBaseNameResult->close();
$timeByBaseNameResult = null;
return $output; return $output;
@ -668,7 +652,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$timeByTLNameResult->close(); $timeByTLNameResult->close();
$timeByTLNameResult = null;
return $output; return $output;
@ -702,7 +685,6 @@ final class NodaIDGetter {
else $output = 0; else $output = 0;
$timeByImportLogResult->close(); $timeByImportLogResult->close();
$timeByImportLogResult = null;
return $output; return $output;

View File

@ -89,7 +89,6 @@ final class NodaLogEdit {
$insertStmt->bind_param("issss", $tag_id, $tool_name, $user_name, $action, $section); $insertStmt->bind_param("issss", $tag_id, $tool_name, $user_name, $action, $section);
$insertStmt->execute(); $insertStmt->execute();
$insertStmt->close(); $insertStmt->close();
$insertStmt = null;
// Update the main tag table, except for edits to the base, // Update the main tag table, except for edits to the base,
// as these have built-in updating and updating in this case // as these have built-in updating and updating in this case
@ -103,7 +102,6 @@ final class NodaLogEdit {
$updateStmt->bind_param("si", $user_name, $tag_id); $updateStmt->bind_param("si", $user_name, $tag_id);
$updateStmt->execute(); $updateStmt->execute();
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
} }
@ -134,7 +132,6 @@ final class NodaLogEdit {
$insertStmt->bind_param("issss", $persinst_id, $tool_name, $user_name, $action, $section); $insertStmt->bind_param("issss", $persinst_id, $tool_name, $user_name, $action, $section);
$insertStmt->execute(); $insertStmt->execute();
$insertStmt->close(); $insertStmt->close();
$insertStmt = null;
} }
@ -163,7 +160,6 @@ final class NodaLogEdit {
$insertStmt->bind_param("issss", $zeit_id, $tool_name, $user_name, $action, $section); $insertStmt->bind_param("issss", $zeit_id, $tool_name, $user_name, $action, $section);
$insertStmt->execute(); $insertStmt->execute();
$insertStmt->close(); $insertStmt->close();
$insertStmt = null;
} }
@ -192,7 +188,6 @@ final class NodaLogEdit {
$insertStmt->bind_param("issss", $ort_id, $tool_name, $user_name, $action, $section); $insertStmt->bind_param("issss", $ort_id, $tool_name, $user_name, $action, $section);
$insertStmt->execute(); $insertStmt->execute();
$insertStmt->close(); $insertStmt->close();
$insertStmt = null;
// Update the main tag table, except for edits to the base, // Update the main tag table, except for edits to the base,
// as these have built-in updating and updating in this case // as these have built-in updating and updating in this case
@ -206,7 +201,6 @@ final class NodaLogEdit {
$updateStmt->bind_param("si", $user_name, $ort_id); $updateStmt->bind_param("si", $user_name, $ort_id);
$updateStmt->execute(); $updateStmt->execute();
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
} }

View File

@ -29,11 +29,10 @@ final class NodaNameGetter {
WHERE `trans_language` = '" . $mysqli_noda->escape_string($lang) . "' WHERE `trans_language` = '" . $mysqli_noda->escape_string($lang) . "'
AND `tag_id` IN (" . implode(', ', $tag_ids) . ")"); AND `tag_id` IN (" . implode(', ', $tag_ids) . ")");
while ($cur = $result->fetch_assoc()) { while ($cur = $result->fetch_row()) {
$output[(int)$cur['tag_id']] = (string)$cur['trans_name']; $output[(int)$cur[0]] = (string)$cur[1];
} }
$result->close(); $result->close();
$result = null;
if (!empty($tag_ids_left = array_diff($tag_ids, array_keys($output)))) { if (!empty($tag_ids_left = array_diff($tag_ids, array_keys($output)))) {
@ -41,11 +40,10 @@ final class NodaNameGetter {
FROM `tag` FROM `tag`
WHERE `tag_id` IN (" . implode(', ', $tag_ids_left) . ")"); WHERE `tag_id` IN (" . implode(', ', $tag_ids_left) . ")");
while ($cur = $result->fetch_assoc()) { while ($cur = $result->fetch_row()) {
$output[(int)$cur['tag_id']] = (string)$cur['tag_name']; $output[(int)$cur[0]] = (string)$cur[1];
} }
$result->close(); $result->close();
$result = null;
} }
@ -76,11 +74,10 @@ final class NodaNameGetter {
WHERE `trans_language` = '" . $mysqli_noda->escape_string($lang) . "' WHERE `trans_language` = '" . $mysqli_noda->escape_string($lang) . "'
AND `ort_id` IN (" . implode(', ', $place_ids) . ")"); AND `ort_id` IN (" . implode(', ', $place_ids) . ")");
while ($cur = $result->fetch_assoc()) { while ($cur = $result->fetch_row()) {
$output[(int)$cur['ort_id']] = (string)$cur['trans_name']; $output[(int)$cur[0]] = (string)$cur[1];
} }
$result->close(); $result->close();
$result = null;
if (!empty($place_ids_left = array_diff($place_ids, array_keys($output)))) { if (!empty($place_ids_left = array_diff($place_ids, array_keys($output)))) {
@ -88,11 +85,10 @@ final class NodaNameGetter {
FROM `orte` FROM `orte`
WHERE `ort_id` IN (" . implode(', ', $place_ids_left) . ")"); WHERE `ort_id` IN (" . implode(', ', $place_ids_left) . ")");
while ($cur = $result->fetch_assoc()) { while ($cur = $result->fetch_row()) {
$output[(int)$cur['ort_id']] = (string)$cur['ort_name']; $output[(int)$cur[0]] = (string)$cur[1];
} }
$result->close(); $result->close();
$result = null;
} }
@ -123,22 +119,20 @@ final class NodaNameGetter {
WHERE `trans_language` = '" . $mysqli_noda->escape_string($lang) . "' WHERE `trans_language` = '" . $mysqli_noda->escape_string($lang) . "'
AND `persinst_id` IN (" . implode(', ', $persinst_ids) . ")"); AND `persinst_id` IN (" . implode(', ', $persinst_ids) . ")");
while ($cur = $result->fetch_assoc()) { while ($cur = $result->fetch_row()) {
$output[(int)$cur['persinst_id']] = (string)$cur['trans_name']; $output[(int)$cur[0]] = (string)$cur[1];
} }
$result->close(); $result->close();
$result = null;
if (!empty($persinst_ids_left = array_diff($persinst_ids, array_keys($output)))) { if (!empty($persinst_ids_left = array_diff($persinst_ids, array_keys($output)))) {
$result = $mysqli_noda->do_read_query("SELECT `persinst_id`, `persinst_name_en` $result = $mysqli_noda->do_read_query("SELECT `persinst_id`, `persinst_name_en`
FROM `persinst` FROM `persinst`
WHERE `persinst_id` IN (" . implode(', ', $persinst_ids_left) . ")"); WHERE `persinst_id` IN (" . implode(', ', $persinst_ids_left) . ")");
while ($cur = $result->fetch_assoc()) { while ($cur = $result->fetch_row()) {
$output[(int)$cur['persinst_id']] = (string)$cur['persinst_name_en']; $output[(int)$cur[0]] = (string)$cur[1];
} }
$result->close(); $result->close();
$result = null;
} }
if (count($output) > 1) { if (count($output) > 1) {
@ -168,11 +162,10 @@ final class NodaNameGetter {
WHERE `trans_language` = '" . $mysqli_noda->escape_string($lang) . "' WHERE `trans_language` = '" . $mysqli_noda->escape_string($lang) . "'
AND `zeit_id` IN (" . implode(', ', $time_ids) . ")"); AND `zeit_id` IN (" . implode(', ', $time_ids) . ")");
while ($cur = $result->fetch_assoc()) { while ($cur = $result->fetch_row()) {
$output[(int)$cur['zeit_id']] = (string)$cur['trans_name']; $output[(int)$cur[0]] = (string)$cur[1];
} }
$result->close(); $result->close();
$result = null;
if (!empty($time_ids_left = array_diff($time_ids, array_keys($output)))) { if (!empty($time_ids_left = array_diff($time_ids, array_keys($output)))) {
@ -180,11 +173,10 @@ final class NodaNameGetter {
FROM `zeiten` FROM `zeiten`
WHERE `zeit_id` IN (" . implode(', ', $time_ids_left) . ")"); WHERE `zeit_id` IN (" . implode(', ', $time_ids_left) . ")");
while ($cur = $result->fetch_assoc()) { while ($cur = $result->fetch_row()) {
$output[(int)$cur['zeit_id']] = (string)$cur['zeit_name']; $output[(int)$cur[0]] = (string)$cur[1];
} }
$result->close(); $result->close();
$result = null;
} }
@ -207,8 +199,6 @@ final class NodaNameGetter {
*/ */
public static function getTagName(MDMysqli $mysqli_noda, string $lang, int $tag_id):string { public static function getTagName(MDMysqli $mysqli_noda, string $lang, int $tag_id):string {
$output = [];
// Get translations // Get translations
$result = $mysqli_noda->query_by_stmt("SELECT `trans_name` $result = $mysqli_noda->query_by_stmt("SELECT `trans_name`
FROM `tag_translation` FROM `tag_translation`

View File

@ -5,7 +5,6 @@
* @author Joshua Ramon Enslin <joshua@museum-digital.de> * @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/ */
declare(strict_types = 1); declare(strict_types = 1);
require_once __DIR__ . '/inc/datesByCountry.php';
/** /**
* Autotranslater class for times. * Autotranslater class for times.
@ -121,14 +120,14 @@ final class NodaTimeAutotranslater {
public static function getSuffixModeForYearsWSuffix(int $start, int $end):NodaTimeAutotranslaterSuffixMode { public static function getSuffixModeForYearsWSuffix(int $start, int $end):NodaTimeAutotranslaterSuffixMode {
if ($start < 0 && $end < 0) { if ($start < 0 && $end < 0) {
$suffixMode = NodaTimeAutotranslaterSuffixMode::BCE; // 2; // " v. Chr."; return NodaTimeAutotranslaterSuffixMode::BCE; // 2; // " v. Chr.";
} }
else if ($end < 1000) { else if ($end < 1000) {
$suffixMode = NodaTimeAutotranslaterSuffixMode::CE; // " n. Chr."; return NodaTimeAutotranslaterSuffixMode::CE; // " n. Chr.";
}
else {
return NodaTimeAutotranslaterSuffixMode::ANY; // Times larger than 1000 n. Chr.
} }
else $suffixMode = NodaTimeAutotranslaterSuffixMode::ANY; // Times larger than 1000 n. Chr.
return $suffixMode;
} }
@ -370,7 +369,7 @@ final class NodaTimeAutotranslater {
*/ */
public static function translateYearsSinceStart(array $timeInfo):array { public static function translateYearsSinceStart(array $timeInfo):array {
$start = \intval($timeInfo['zeit_beginn']); // $start = \intval($timeInfo['zeit_beginn']);
if (substr((string)$timeInfo['zeit_name'], 0, 5) === "Nach ") { if (substr((string)$timeInfo['zeit_name'], 0, 5) === "Nach ") {
return self::translateYearsAfterStart($timeInfo); return self::translateYearsAfterStart($timeInfo);
@ -407,7 +406,7 @@ final class NodaTimeAutotranslater {
if (empty(\trim((string)$timeInfo['zeit_zaehlzeit_monat'], " ,.;0"))) { if (empty(\trim((string)$timeInfo['zeit_zaehlzeit_monat'], " ,.;0"))) {
$timeInfo['zeit_ende'] = \strval(\intval($timeInfo['zeit_ende']) + 1); $timeInfo['zeit_ende'] = \strval(\intval($timeInfo['zeit_ende']) + 1);
} }
$end = \intval($timeInfo['zeit_ende']); // $end = \intval($timeInfo['zeit_ende']);
$innerTimeInfo = $timeInfo; $innerTimeInfo = $timeInfo;
$innerTimeInfo['zeit_beginn'] = $timeInfo['zeit_ende']; $innerTimeInfo['zeit_beginn'] = $timeInfo['zeit_ende'];
@ -438,7 +437,7 @@ final class NodaTimeAutotranslater {
*/ */
public static function translateYearsUntilEnd(array $timeInfo):array { public static function translateYearsUntilEnd(array $timeInfo):array {
$end = \intval($timeInfo['zeit_ende']); // $end = \intval($timeInfo['zeit_ende']);
if (substr((string)$timeInfo['zeit_name'], 0, 4) === "Vor ") { if (substr((string)$timeInfo['zeit_name'], 0, 4) === "Vor ") {
return self::translateYearsBeforeEnd($timeInfo); return self::translateYearsBeforeEnd($timeInfo);

View File

@ -1086,7 +1086,7 @@ final class NodaTimeSplitter {
if (strlen($start_name) === 9 and substr($start_name, 4, 1) === '-') $start_name = substr($start_name, 0, 4); if (strlen($start_name) === 9 and substr($start_name, 4, 1) === '-') $start_name = substr($start_name, 0, 4);
if (strlen($end_name) === 9 and substr($end_name, 4, 1) === '-') $end_name = substr($end_name, 5, 4); if (strlen($end_name) === 9 and substr($end_name, 4, 1) === '-') $end_name = substr($end_name, 5, 4);
$output = [ return [
"start_name" => $start_name, "start_name" => $start_name,
"end_name" => $end_name, "end_name" => $end_name,
"start_year" => $start[0], "start_year" => $start[0],
@ -1097,8 +1097,6 @@ final class NodaTimeSplitter {
"counting_time_bcce" => "+", "counting_time_bcce" => "+",
]; ];
return $output;
} }
/** /**

View File

@ -269,15 +269,13 @@ final class NodaWikidataFetcher {
} }
$sparqlQueryString = 'SELECT ?id ?idLabel WHERE { return 'SELECT ?id ?idLabel WHERE {
?id wdt:' . $repoPId . ' "' . $externalId . '". ?id wdt:' . $repoPId . ' "' . $externalId . '".
SERVICE wikibase:label { SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" . bd:serviceParam wikibase:language "en" .
} }
}'; }';
return $sparqlQueryString;
} }
/** /**
@ -566,22 +564,25 @@ final class NodaWikidataFetcher {
FROM `persinst` FROM `persinst`
WHERE `persinst_id` = ?", "i", $persinst_id); WHERE `persinst_id` = ?", "i", $persinst_id);
if (!($cinfo = $cergebnis->fetch_row())) {
throw new Exception("There is no actor of ID #" . $persinst_id);
}
$cergebnis->close();
$persinst_kurzinfo = $cinfo[0];
$display_name = $cinfo[1];
// Update persinst table // Update persinst table
$updatePersinstStmt = $this->_mysqli_noda->do_prepare("UPDATE `persinst` $updatePersinstStmt = $this->_mysqli_noda->do_prepare("UPDATE `persinst`
SET `persinst_kurzinfo` = ? SET `persinst_kurzinfo` = ?
WHERE `persinst_id` = ?"); WHERE `persinst_id` = ?");
if ($cergebnis->num_rows === 0) { if (!empty($persinst_kurzinfo) and substr($persinst_kurzinfo, 0, 3) !== 'GND') {
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') {
switch ($this->_retrievalMode) { switch ($this->_retrievalMode) {
case "add": case "add":
$newDesc = $cinfo['persinst_kurzinfo'] . PHP_EOL . PHP_EOL . $datafromwiki; $newDesc = $persinst_kurzinfo . PHP_EOL . PHP_EOL . $datafromwiki;
$updatePersinstStmt->bind_param("si", $newDesc, $persinst_id); $updatePersinstStmt->bind_param("si", $newDesc, $persinst_id);
$updatePersinstStmt->execute(); $updatePersinstStmt->execute();
@ -589,7 +590,6 @@ final class NodaWikidataFetcher {
break; break;
case "keep": case "keep":
$newDesc = $cinfo['persinst_kurzinfo'];
break; break;
case "replace": case "replace":
@ -603,12 +603,12 @@ final class NodaWikidataFetcher {
$tlLoader = new MDTlLoader("wiki_getter_persinst", $preflang); $tlLoader = new MDTlLoader("wiki_getter_persinst", $preflang);
echo self::generateHTMLHeadForWikidataFetcher($lang); echo self::generateHTMLHeadForWikidataFetcher($lang);
echo self::generateWikidataFetcherHeader($tlLoader, "", $cinfo['display_name']); echo self::generateWikidataFetcherHeader($tlLoader, "", $display_name);
echo ' echo '
<p class="alert icons iconsAlert">Es gibt schon einen Eintrag im Beschreibungsfeld</p> <p class="alert icons iconsAlert">Es gibt schon einen Eintrag im Beschreibungsfeld</p>
<div class="wikiReplaceTTile"> <div class="wikiReplaceTTile">
<h3>Bisher vorhanden</h3> <h3>Bisher vorhanden</h3>
<p>' . nl2br($cinfo['persinst_kurzinfo']) . '</p> <p>' . nl2br($persinst_kurzinfo) . '</p>
</div> </div>
<div class="wikiReplaceTTile"> <div class="wikiReplaceTTile">
<h3>Jetzt gefunden</h3><p>' . $datafromwiki . '</p> <h3>Jetzt gefunden</h3><p>' . $datafromwiki . '</p>
@ -630,8 +630,6 @@ final class NodaWikidataFetcher {
$output = true; $output = true;
} }
$cergebnis->close();
$updatePersinstStmt->close(); $updatePersinstStmt->close();
// Set link to Wikipedia in noda table // Set link to Wikipedia in noda table
@ -653,7 +651,6 @@ final class NodaWikidataFetcher {
$updatePersinstEditInfoStmt->bind_param("si", $erfasst_von, $persinst_id); $updatePersinstEditInfoStmt->bind_param("si", $erfasst_von, $persinst_id);
$updatePersinstEditInfoStmt->execute(); $updatePersinstEditInfoStmt->execute();
$updatePersinstEditInfoStmt->close(); $updatePersinstEditInfoStmt->close();
$updatePersinstEditInfoStmt = null;
return $output; return $output;
@ -677,7 +674,6 @@ final class NodaWikidataFetcher {
throw new MDmainEntityNotExistentException("Failed to fetch actor information"); throw new MDmainEntityNotExistentException("Failed to fetch actor information");
} }
$result->close(); $result->close();
$result = null;
if ($actor_dates['persinst_geburtsjahr'] === '') { if ($actor_dates['persinst_geburtsjahr'] === '') {
@ -698,7 +694,6 @@ final class NodaWikidataFetcher {
$updateStmt->bind_param("ii", $birth_date, $persinst_id); $updateStmt->bind_param("ii", $birth_date, $persinst_id);
$updateStmt->execute(); $updateStmt->execute();
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
} }
} }
@ -718,7 +713,6 @@ final class NodaWikidataFetcher {
$updateStmt->bind_param("ii", $death_date, $persinst_id); $updateStmt->bind_param("ii", $death_date, $persinst_id);
$updateStmt->execute(); $updateStmt->execute();
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
} }
} }
@ -755,7 +749,6 @@ final class NodaWikidataFetcher {
$updateStmt->bind_param("si", $wikidata_gender, $persinst_id); $updateStmt->bind_param("si", $wikidata_gender, $persinst_id);
$updateStmt->execute(); $updateStmt->execute();
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
} }
} }
@ -901,8 +894,6 @@ final class NodaWikidataFetcher {
if (!empty($languagesToFetch[$lang]) && !empty($data['sitelinks'][$lang . 'wiki'])) { if (!empty($languagesToFetch[$lang]) && !empty($data['sitelinks'][$lang . 'wiki'])) {
$url = $languagesToFetch[$lang];
$wikilink = $wikilinks[$lang]; $wikilink = $wikilinks[$lang];
if (!empty($contents[$lang])) { if (!empty($contents[$lang])) {
@ -1060,11 +1051,9 @@ final class NodaWikidataFetcher {
LIMIT 1", "i", $onum); LIMIT 1", "i", $onum);
if ($result->num_rows !== 0) { if ($result->num_rows !== 0) {
$result->close(); $result->close();
$result = null;
return; return;
} }
$result->close(); $result->close();
$result = null;
// If there is no superordinate, check if the identified superordinate // If there is no superordinate, check if the identified superordinate
// is known in the noda DB. // is known in the noda DB.
@ -1078,11 +1067,9 @@ final class NodaWikidataFetcher {
if (!($superordinateData = $result->fetch_row())) { if (!($superordinateData = $result->fetch_row())) {
$result->close(); $result->close();
$result = null;
return; return;
} }
$result->close(); $result->close();
$result = null;
$topPlaceId = $superordinateData[0]; $topPlaceId = $superordinateData[0];
@ -1094,7 +1081,6 @@ final class NodaWikidataFetcher {
$insertStmt->bind_param("ii", $topPlaceId, $onum); $insertStmt->bind_param("ii", $topPlaceId, $onum);
$insertStmt->execute(); $insertStmt->execute();
$insertStmt->close(); $insertStmt->close();
$insertStmt = null;
} }
@ -1281,8 +1267,6 @@ final class NodaWikidataFetcher {
if (!empty($languagesToFetch[$lang]) && !empty($data['sitelinks'][$lang . 'wiki'])) { if (!empty($languagesToFetch[$lang]) && !empty($data['sitelinks'][$lang . 'wiki'])) {
$url = $languagesToFetch[$lang];
$wikilink = $wikilinks[$lang]; $wikilink = $wikilinks[$lang];
if (!empty($contents[$lang])) { if (!empty($contents[$lang])) {
@ -1364,14 +1348,13 @@ final class NodaWikidataFetcher {
FROM `tag` FROM `tag`
WHERE `tag_id` = ?", "i", $tag_id); WHERE `tag_id` = ?", "i", $tag_id);
if (!($cinfo = $cergebnis->fetch_assoc())) { if (!($cinfo = $cergebnis->fetch_row())) {
$cergebnis->close(); $cergebnis->close();
$cergebnis = null;
return $output; return $output;
} }
$cergebnis->close(); $cergebnis->close();
$cergebnis = null;
$tag_anmerkung = $cinfo[0];
$this->_mysqli_noda->autocommit(false); $this->_mysqli_noda->autocommit(false);
@ -1379,12 +1362,12 @@ final class NodaWikidataFetcher {
SET `tag_anmerkung` = ? SET `tag_anmerkung` = ?
WHERE `tag_id` = ?"); WHERE `tag_id` = ?");
if (!empty($cinfo['tag_anmerkung']) and substr($cinfo['tag_anmerkung'], 0, 3) !== 'GND') { if (!empty($tag_anmerkung) and substr($tag_anmerkung, 0, 3) !== 'GND') {
switch ($this->_retrievalMode) { switch ($this->_retrievalMode) {
case "add": case "add":
$newDesc = $cinfo['tag_anmerkung'] . PHP_EOL . PHP_EOL . $datafromwiki; $newDesc = $tag_anmerkung . PHP_EOL . PHP_EOL . $datafromwiki;
$updateTagDescStmt->bind_param("si", $newDesc, $tag_id); $updateTagDescStmt->bind_param("si", $newDesc, $tag_id);
$updateTagDescStmt->execute(); $updateTagDescStmt->execute();
@ -1392,7 +1375,6 @@ final class NodaWikidataFetcher {
break; break;
case "keep": case "keep":
$newDesc = $cinfo['tag_anmerkung'];
break; break;
case "replace": case "replace":
@ -1410,7 +1392,7 @@ final class NodaWikidataFetcher {
echo ' echo '
<p class="alert icons iconsAlert">Es gibt schon einen Eintrag im Beschreibungsfeld</b> <p class="alert icons iconsAlert">Es gibt schon einen Eintrag im Beschreibungsfeld</b>
<div class="wikiReplaceTTile"> <div class="wikiReplaceTTile">
<h3>Bisher vorhanden</h3><p>' . nl2br($cinfo['tag_anmerkung']) . '</p> <h3>Bisher vorhanden</h3><p>' . nl2br($tag_anmerkung) . '</p>
</div> </div>
<div class="wikiReplaceTTile"> <div class="wikiReplaceTTile">
<h3>Jetzt gefunden</h3><p>' . $datafromwiki . '<p> <h3>Jetzt gefunden</h3><p>' . $datafromwiki . '<p>
@ -1432,7 +1414,6 @@ final class NodaWikidataFetcher {
} }
$updateTagDescStmt->close(); $updateTagDescStmt->close();
$updateTagDescStmt = null;
$insertNodaTagStmt = $this->_mysqli_noda->do_prepare("INSERT INTO `noda_tag` $insertNodaTagStmt = $this->_mysqli_noda->do_prepare("INSERT INTO `noda_tag`
(`tag_id`, `noda_source`, `noda_nrinsource`, `noda_link`, `noda_erfasst_von`) (`tag_id`, `noda_source`, `noda_nrinsource`, `noda_link`, `noda_erfasst_von`)
@ -1453,7 +1434,6 @@ final class NodaWikidataFetcher {
$updateTagEditInfoStmt->bind_param("si", $erfasst_von, $tag_id); $updateTagEditInfoStmt->bind_param("si", $erfasst_von, $tag_id);
$updateTagEditInfoStmt->execute(); $updateTagEditInfoStmt->execute();
$updateTagEditInfoStmt->close(); $updateTagEditInfoStmt->close();
$updateTagEditInfoStmt = null;
$this->_mysqli_noda->commit(); $this->_mysqli_noda->commit();
$this->_mysqli_noda->autocommit(true); $this->_mysqli_noda->autocommit(true);
@ -1499,7 +1479,6 @@ final class NodaWikidataFetcher {
} }
$insertNodaTagStmt->close(); $insertNodaTagStmt->close();
$insertNodaTagStmt = null;
$this->_mysqli_noda->commit(); $this->_mysqli_noda->commit();
$this->_mysqli_noda->autocommit(true); $this->_mysqli_noda->autocommit(true);
@ -1613,8 +1592,6 @@ final class NodaWikidataFetcher {
if (!empty($languagesToFetch[$lang]) && !empty($data['sitelinks'][$lang . 'wiki'])) { if (!empty($languagesToFetch[$lang]) && !empty($data['sitelinks'][$lang . 'wiki'])) {
$url = $languagesToFetch[$lang];
$wikilink = $wikilinks[$lang]; $wikilink = $wikilinks[$lang];
if (!empty($contents[$lang])) { if (!empty($contents[$lang])) {

View File

@ -28,11 +28,9 @@ final class NodaPersinstFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return; return;
} }
$result->close(); $result->close();
$result = null;
$this->_mysqli_noda->do_update_query_large("DELETE FROM `persinst_fulltext` $this->_mysqli_noda->do_update_query_large("DELETE FROM `persinst_fulltext`
WHERE NOT EXISTS (SELECT 1 FROM `persinst` WHERE NOT EXISTS (SELECT 1 FROM `persinst`
@ -58,7 +56,6 @@ final class NodaPersinstFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return []; return [];
} }
@ -70,7 +67,6 @@ final class NodaPersinstFulltextSync {
$toUpdate[$persinst_id] = $cur; $toUpdate[$persinst_id] = $cur;
} }
$result->close(); $result->close();
$result = null;
$tlResult = $this->_mysqli_noda->do_read_query("SELECT `persinst_translation`.`persinst_id`, `trans_name` AS `name` $tlResult = $this->_mysqli_noda->do_read_query("SELECT `persinst_translation`.`persinst_id`, `trans_name` AS `name`
FROM `persinst_translation` FROM `persinst_translation`
@ -85,7 +81,6 @@ final class NodaPersinstFulltextSync {
else $translations[$persinst_id][] = $cur['name']; else $translations[$persinst_id][] = $cur['name'];
} }
$tlResult->close(); $tlResult->close();
$tlResult = null;
$newEntries = []; $newEntries = [];
@ -126,7 +121,6 @@ final class NodaPersinstFulltextSync {
} }
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
if (count($toUpdate) > 1) { if (count($toUpdate) > 1) {
$this->_mysqli_noda->commit(); $this->_mysqli_noda->commit();

View File

@ -29,11 +29,9 @@ final class NodaPlaceFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return; return;
} }
$result->close(); $result->close();
$result = null;
$this->_mysqli_noda->do_update_query_large("DELETE FROM `orte_fulltext` $this->_mysqli_noda->do_update_query_large("DELETE FROM `orte_fulltext`
WHERE NOT EXISTS (SELECT 1 FROM `orte` WHERE NOT EXISTS (SELECT 1 FROM `orte`
@ -59,7 +57,6 @@ final class NodaPlaceFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return []; return [];
} }
@ -71,7 +68,6 @@ final class NodaPlaceFulltextSync {
$toUpdate[$ort_id] = $cur; $toUpdate[$ort_id] = $cur;
} }
$result->close(); $result->close();
$result = null;
$tlResult = $this->_mysqli_noda->do_read_query("SELECT `ort_translation`.`ort_id`, `trans_name` AS `name` $tlResult = $this->_mysqli_noda->do_read_query("SELECT `ort_translation`.`ort_id`, `trans_name` AS `name`
FROM `ort_translation` FROM `ort_translation`
@ -86,7 +82,6 @@ final class NodaPlaceFulltextSync {
else $translations[$ort_id][] = $cur['name']; else $translations[$ort_id][] = $cur['name'];
} }
$tlResult->close(); $tlResult->close();
$tlResult = null;
$newEntries = []; $newEntries = [];
@ -127,7 +122,6 @@ final class NodaPlaceFulltextSync {
} }
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
if (count($toUpdate) > 1) { if (count($toUpdate) > 1) {
$this->_mysqli_noda->commit(); $this->_mysqli_noda->commit();

View File

@ -29,11 +29,9 @@ final class NodaSourceFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return; return;
} }
$result->close(); $result->close();
$result = null;
$this->_mysqli_noda->do_update_query_large("DELETE FROM `source_fulltext_search` $this->_mysqli_noda->do_update_query_large("DELETE FROM `source_fulltext_search`
WHERE NOT EXISTS (SELECT 1 FROM `source` WHERE NOT EXISTS (SELECT 1 FROM `source`
@ -60,7 +58,6 @@ final class NodaSourceFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return []; return [];
} }
@ -73,7 +70,6 @@ final class NodaSourceFulltextSync {
$toUpdate[$source_id] = $cur; $toUpdate[$source_id] = $cur;
} }
$result->close(); $result->close();
$result = null;
$authorsResult = $this->_mysqli_noda->do_read_query("SELECT `source_author`.`source_id`, `persinst_anzeigename` AS `name` $authorsResult = $this->_mysqli_noda->do_read_query("SELECT `source_author`.`source_id`, `persinst_anzeigename` AS `name`
FROM `persinst`, `source_author` FROM `persinst`, `source_author`
@ -89,7 +85,6 @@ final class NodaSourceFulltextSync {
else $authors[$source_id][] = $cur['name']; else $authors[$source_id][] = $cur['name'];
} }
$authorsResult->close(); $authorsResult->close();
$authorsResult = null;
$newEntries = []; $newEntries = [];
@ -131,7 +126,6 @@ final class NodaSourceFulltextSync {
} }
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
if (count($toUpdate) > 1) { if (count($toUpdate) > 1) {
$this->_mysqli_noda->commit(); $this->_mysqli_noda->commit();

View File

@ -29,11 +29,9 @@ final class NodaTagFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return; return;
} }
$result->close(); $result->close();
$result = null;
$this->_mysqli_noda->do_update_query_large("DELETE FROM `tag_fulltext` $this->_mysqli_noda->do_update_query_large("DELETE FROM `tag_fulltext`
WHERE NOT EXISTS (SELECT 1 FROM `tag` WHERE NOT EXISTS (SELECT 1 FROM `tag`
@ -59,7 +57,6 @@ final class NodaTagFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return []; return [];
} }
@ -71,7 +68,6 @@ final class NodaTagFulltextSync {
$toUpdate[$tag_id] = $cur; $toUpdate[$tag_id] = $cur;
} }
$result->close(); $result->close();
$result = null;
$tlResult = $this->_mysqli_noda->do_read_query("SELECT `tag_translation`.`tag_id`, `trans_name` AS `name` $tlResult = $this->_mysqli_noda->do_read_query("SELECT `tag_translation`.`tag_id`, `trans_name` AS `name`
FROM `tag_translation` FROM `tag_translation`
@ -86,7 +82,6 @@ final class NodaTagFulltextSync {
else $translations[$tag_id][] = $cur['name']; else $translations[$tag_id][] = $cur['name'];
} }
$tlResult->close(); $tlResult->close();
$tlResult = null;
$newEntries = []; $newEntries = [];
@ -127,7 +122,6 @@ final class NodaTagFulltextSync {
} }
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
if (count($toUpdate) > 1) { if (count($toUpdate) > 1) {
$this->_mysqli_noda->commit(); $this->_mysqli_noda->commit();

View File

@ -29,11 +29,9 @@ final class NodaTimeFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return; return;
} }
$result->close(); $result->close();
$result = null;
$this->_mysqli_noda->do_update_query_large("DELETE FROM `zeiten_fulltext` $this->_mysqli_noda->do_update_query_large("DELETE FROM `zeiten_fulltext`
WHERE NOT EXISTS (SELECT 1 FROM `zeiten` WHERE NOT EXISTS (SELECT 1 FROM `zeiten`
@ -59,7 +57,6 @@ final class NodaTimeFulltextSync {
if ($result->num_rows === 0) { if ($result->num_rows === 0) {
$result->close(); $result->close();
$result = null;
return []; return [];
} }
@ -71,7 +68,6 @@ final class NodaTimeFulltextSync {
$toUpdate[$zeit_id] = $cur; $toUpdate[$zeit_id] = $cur;
} }
$result->close(); $result->close();
$result = null;
$tlResult = $this->_mysqli_noda->do_read_query("SELECT `zeit_translation`.`zeit_id`, `trans_name` AS `name` $tlResult = $this->_mysqli_noda->do_read_query("SELECT `zeit_translation`.`zeit_id`, `trans_name` AS `name`
FROM `zeit_translation` FROM `zeit_translation`
@ -86,7 +82,6 @@ final class NodaTimeFulltextSync {
else $translations[$time_id][] = $cur['name']; else $translations[$time_id][] = $cur['name'];
} }
$tlResult->close(); $tlResult->close();
$tlResult = null;
$newEntries = []; $newEntries = [];
@ -127,7 +122,6 @@ final class NodaTimeFulltextSync {
} }
$updateStmt->close(); $updateStmt->close();
$updateStmt = null;
if (count($toUpdate) > 1) { if (count($toUpdate) > 1) {
$this->_mysqli_noda->commit(); $this->_mysqli_noda->commit();