aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2020-05-13 04:04:53 +0200
committerfilip <filip.komar@gmail.com>2020-05-13 04:04:53 +0200
commit65e18b641da2290ef9ef869e12d1e7f18cd918cd (patch)
tree78b7f3f101f0d836338049d0446471dd69ba13f9
parentf20831031d00f462388783e08ea47dee03a3853a (diff)
workaround to add second values with unescaped comma in csv line to the previous (valid) value + added debug faults array
-rw-r--r--lib/Downloads.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Downloads.php b/lib/Downloads.php
index 5d1e676f8..f4b21f85f 100644
--- a/lib/Downloads.php
+++ b/lib/Downloads.php
@@ -156,6 +156,7 @@ class Downloads
$mirror_cities = array();
$mirror_countries = array();
$refresh_country_and_city_arrays = false;
+ $faults = array();
if ($prod == false && $documentation == false && $mirrorlist == false) {
function _r($passthru) {return '_r("' . $passthru . '")';};
include_once(realpath(__DIR__) . '/../en/downloads/get/lib.php');
@@ -168,6 +169,14 @@ class Downloads
$val = explode('=', trim($val));
if (!empty($val[1])) {
$m[$val[0]] = $val[1];
+ } else {
+ // workaround to add second values with unescaped comma in csv line to the previous (valid) value
+ end($m);
+ $m[key($m)] = $m[key($m)] . ", " . $val[0];
+ if ($refresh_country_and_city_arrays == true) {
+ // store $line to examine faults
+ $faults[] = $line;
+ }
}
}
$pu = parse_url($m['url']);
@@ -187,6 +196,16 @@ class Downloads
} else {
$mirror_cities[$m['city']] = '_r("' . $m['city'] . '") // new city (not yet in /en/downloads/get/lib.php)';
}
+ } else if ($refresh_country_and_city_arrays == true) {
+ // store data in $faults array to easy find location manually with latitude and longitude if needed
+ $latitude = $m['latitude'];
+ $longitude = $m['longitude'];
+ $map_magnification = 5;
+ $map_data = "set latitude is $latitude and longitude $longitude";
+ $map_data .= " (<a href=\"https://www.openstreetmap.org/search?query=" . $latitude;
+ $map_data .= "%20" . $longitude . "#map=" . $map_magnification . "/" . $latitude;
+ $map_data .= "/" . $longitude . "\" >OpenStreetMap</a>)";
+ $faults[$map_data] = $line;
}
if (isset($countries[$item['country']])) {
$mirror_countries[$item['country']] = $countries[$item['country']];
@@ -241,6 +260,8 @@ class Downloads
var_export($mirror_cities);
echo ";\nArray of countries for i18n: ";
var_export($countries_u);
+ echo ";\nArray of faults: ";
+ var_export($faults);
echo ";\n";
}
echo "\nRemove char ' at each value on both arrays for cities and countries above : replace '_r(\" with just _r( and also behind \")', with \"),\n";