Delete incomplete track in case of import error
This commit is contained in:
parent
66db684819
commit
ed3e18ef0c
@ -93,6 +93,7 @@ foreach ($gpx->trk as $trk) {
|
|||||||
uUtils::exitWithError($lang["servererror"]);
|
uUtils::exitWithError($lang["servererror"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$track = new uTrack($trackId);
|
||||||
|
|
||||||
foreach($trk->trkseg as $segment) {
|
foreach($trk->trkseg as $segment) {
|
||||||
foreach($segment->trkpt as $point) {
|
foreach($segment->trkpt as $point) {
|
||||||
@ -110,10 +111,11 @@ foreach ($gpx->trk as $trk) {
|
|||||||
if (count($ext->accuracy)) { $accuracy = (int) $ext->accuracy; }
|
if (count($ext->accuracy)) { $accuracy = (int) $ext->accuracy; }
|
||||||
if (count($ext->provider)) { $provider = (string) $ext->provider; }
|
if (count($ext->provider)) { $provider = (string) $ext->provider; }
|
||||||
}
|
}
|
||||||
$ret = uPosition::add($user->id, $trackId,
|
$ret = $track->addPosition($auth->user->id,
|
||||||
$time, (double) $point["lat"], (double) $point["lon"], $altitude,
|
$time, (double) $point["lat"], (double) $point["lon"], $altitude,
|
||||||
$speed, $bearing, $accuracy, $provider, NULL, NULL);
|
$speed, $bearing, $accuracy, $provider, NULL, NULL);
|
||||||
if ($ret === false) {
|
if ($ret === false) {
|
||||||
|
$track->delete();
|
||||||
uUtils::exitWithError($lang["servererror"]);
|
uUtils::exitWithError($lang["servererror"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user