Harmonize JSON API error messages

This commit is contained in:
2026-08-25 23:44:26 +02:00
parent 0d4b159ab3
commit f1b90a4d83
18 changed files with 254 additions and 175 deletions
+11 -5
View File
@@ -17,7 +17,7 @@ class Converter extends PhpObject {
parent::__construct(__CLASS__);
}
public static function convertToGeoJson($sCodeName) {
public static function convertToGeoJson(string $sCodeName) {
$oGpx = new Gpx($sCodeName);
$oGeoJson = new GeoJson($sCodeName);
@@ -32,11 +32,17 @@ class Converter extends PhpObject {
];
}
public static function isGeoJsonValid($sCodeName) {
public static function hasGpxFile(string $sCodeName) {
return ($sCodeName != '' && file_exists(Gpx::getBackendFilePath($sCodeName)));
}
public static function isGeoJsonValid(string $sCodeName) {
$sGpxFilePath = Gpx::getBackendFilePath($sCodeName);
$sGeoJsonFilePath = GeoJson::getBackendFilePath($sCodeName);
//No need to generate if gpx is missing
return !file_exists($sGpxFilePath) || file_exists($sGeoJsonFilePath) && filemtime($sGeoJsonFilePath) >= filemtime($sGpxFilePath);
return
!self::hasGpxFile($sCodeName) //No GPX, no need for geoJSON
||
file_exists($sGeoJsonFilePath) && filemtime($sGeoJsonFilePath) >= filemtime($sGpxFilePath); //geoJSON needs to be (re)generated
}
}
}