Compare commits
No commits in common. "12a7937218ea07d58f931bb949397921dba565a7" and "107a4cd640e362daf57df191f90fbe03ee993faa" have entirely different histories.
12a7937218
...
107a4cd640
|
@ -134,7 +134,7 @@ final class NodaWikidataFetcher {
|
|||
$doc->loadXML('<section>' . trim($input) . '</section>');
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw new Exception("Failed to load DOMDocument." . PHP_EOL . $e->getMessage() . PHP_EOL . PHP_EOL . '---' . $input . '---');
|
||||
throw new Exception("Failed to load DOMDocument." . PHP_EOL . $e->getMessage() . PHP_EOL . PHP_EOL . $input);
|
||||
}
|
||||
|
||||
$list = $doc->getElementsByTagName("style");
|
||||
|
@ -224,6 +224,7 @@ final class NodaWikidataFetcher {
|
|||
|
||||
$input = str_replace("\t", " ", $input);
|
||||
|
||||
return $input;
|
||||
// Remove newlines with ensuing spaces
|
||||
while (strpos($input, PHP_EOL . " ") !== false) {
|
||||
$input = str_replace(PHP_EOL . " ", PHP_EOL, $input);
|
||||
|
@ -628,7 +629,7 @@ final class NodaWikidataFetcher {
|
|||
|
||||
$output = [];
|
||||
|
||||
# $descs = [];
|
||||
$descs = [];
|
||||
foreach ($checkagainstLanguage as $lang) {
|
||||
|
||||
if (!empty($languagesToFetch[$lang]) && !empty($data['sitelinks'][$lang . 'wiki']) && !empty($wikilinks[$lang])) {
|
||||
|
@ -649,7 +650,7 @@ final class NodaWikidataFetcher {
|
|||
}
|
||||
|
||||
if ($tDescription !== '') {
|
||||
# $descs[$lang] = $tDescription;
|
||||
$descs[$lang] = $tDescription;
|
||||
$desc_cleaned = self::_cleanWikidataInput($tDescription);
|
||||
if ($desc_cleaned !== '') {
|
||||
$output[$lang] = [
|
||||
|
@ -671,6 +672,7 @@ final class NodaWikidataFetcher {
|
|||
];
|
||||
|
||||
}
|
||||
# print_r($descs);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1005,7 +1007,7 @@ final class NodaWikidataFetcher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the current description of a place.
|
||||
* Gets the current description of a place.
|
||||
*
|
||||
* @param integer $onum Place ID.
|
||||
*
|
||||
|
@ -1027,29 +1029,6 @@ final class NodaWikidataFetcher {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current description of a tag.
|
||||
*
|
||||
* @param integer $tag_id Tag ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getTagDescription(int $tag_id):string {
|
||||
|
||||
$result = $this->_mysqli_noda->query_by_stmt("SELECT `tag_anmerkung`
|
||||
FROM `tag`
|
||||
WHERE `tag_id` = ?", "i", $tag_id);
|
||||
|
||||
if (!($cur = $result->fetch_row())) {
|
||||
$result->close();
|
||||
return '';
|
||||
}
|
||||
$result->close();
|
||||
|
||||
return $cur[0];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for entering base information about a place from wikidata.
|
||||
*
|
||||
|
@ -1260,14 +1239,14 @@ final class NodaWikidataFetcher {
|
|||
}
|
||||
|
||||
if (isset($data['claims']['P625'])) {
|
||||
$latitude_wd = \filter_var($data['claims']['P625'][0]['mainsnak']['datavalue']['value']['latitude'], FILTER_VALIDATE_FLOAT);
|
||||
$longitude_wd = \filter_var($data['claims']['P625'][0]['mainsnak']['datavalue']['value']['longitude'], FILTER_VALIDATE_FLOAT);
|
||||
$latitude_wd = $data['claims']['P625'][0]['mainsnak']['datavalue']['value']['latitude'];
|
||||
$longitude_wd = $data['claims']['P625'][0]['mainsnak']['datavalue']['value']['longitude'];
|
||||
}
|
||||
|
||||
NodaBatchInserter::linkNodaForPlace($this->_mysqli_noda, $onum, $nodaLinks, $erfasst_von);
|
||||
|
||||
$this->_mysqli_noda->autocommit(false);
|
||||
if (!empty($tgn_id) and is_numeric($tgn_id)) {
|
||||
if (!empty($tgn_id)) {
|
||||
|
||||
$updateStmt = $this->_mysqli_noda->do_prepare("UPDATE `orte`
|
||||
SET `ort_land` = ?
|
||||
|
@ -1278,7 +1257,7 @@ final class NodaWikidataFetcher {
|
|||
unset($updateStmt);
|
||||
|
||||
}
|
||||
if (!empty($geonames_id) and is_numeric($geonames_id)) {
|
||||
if (!empty($geonames_id)) {
|
||||
|
||||
$updateStmt = $this->_mysqli_noda->do_prepare("UPDATE `orte`
|
||||
SET `ort_geonames` = ?
|
||||
|
@ -1363,7 +1342,17 @@ final class NodaWikidataFetcher {
|
|||
$datafromwiki = '"' . $datafromwiki . '" - (Wikipedia (' . $lang . ') ' . date("d.m.Y") . ')';
|
||||
$datafromwiki = str_replace("'", "´", MD_STD::preg_replace_str("/\&\#91\;[0-9]\&\#93\;/", '', $datafromwiki));
|
||||
|
||||
$tag_anmerkung = $this->getTagDescription($tag_id);
|
||||
$cergebnis = $this->_mysqli_noda->query_by_stmt("SELECT `tag_anmerkung`
|
||||
FROM `tag`
|
||||
WHERE `tag_id` = ?", "i", $tag_id);
|
||||
|
||||
if (!($cinfo = $cergebnis->fetch_row())) {
|
||||
$cergebnis->close();
|
||||
return $output;
|
||||
}
|
||||
$cergebnis->close();
|
||||
|
||||
$tag_anmerkung = $cinfo[0];
|
||||
|
||||
$this->_mysqli_noda->autocommit(false);
|
||||
|
||||
|
|
|
@ -255,6 +255,9 @@ Transclusion expansion time report (%,ms,calls,template)
|
|||
"Start of parsed Wikipedia text should be:" . PHP_EOL . PHP_EOL . $expected . PHP_EOL . PHP_EOL . 'Real start text is: ' . PHP_EOL . PHP_EOL . substr($output, 0, 250)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user