From 65e18b641da2290ef9ef869e12d1e7f18cd918cd Mon Sep 17 00:00:00 2001 From: filip Date: Wed, 13 May 2020 04:04:53 +0200 Subject: workaround to add second values with unescaped comma in csv line to the previous (valid) value + added debug faults array --- lib/Downloads.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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 .= " (OpenStreetMap)"; + $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"; -- cgit v1.2.1