places-setup: fix unlink warnings

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-05-05 02:19:15 -07:00
parent 29d1e92421
commit 402e12b287
1 changed files with 8 additions and 4 deletions

View File

@ -97,10 +97,14 @@ class Places
flush();
$filename = sys_get_temp_dir().'/planet_coarse_boundaries.zip';
unlink($filename);
if (file_exists($filename) && !unlink($filename)) {
throw new \Exception("Failed to delete old planet zip file: $filename");
}
$txtfile = sys_get_temp_dir().'/planet_coarse_boundaries.txt';
unlink($txtfile);
if (file_exists($txtfile) && !unlink($txtfile)) {
throw new \Exception("Failed to delete old planet data file: $txtfile");
}
$fp = fopen($filename, 'w+');
@ -130,7 +134,7 @@ class Places
}
// Delete zip file
unlink($filename);
@unlink($filename);
return $txtfile;
}
@ -329,7 +333,7 @@ class Places
$this->config->setSystemValue('memories.gis_type', $gis);
// Delete data file
unlink($datafile);
@unlink($datafile);
}
/**