Harmonize JSON API error messages
This commit is contained in:
+11
-5
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user