check if file exists before unlink

This commit is contained in:
Derek Macias 2016-09-10 00:09:15 -06:00
parent a8a506a125
commit ec095dc289

View File

@ -91,6 +91,7 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa
if (file_check_sha1($pkg_file, $pkg_sha1)){
logger($pkg_gitname.' package download sucessful!', $argq);
}else{
if (file_exists($pkg_file))
unlink($pkg_file);
logger($pkg_gitname.' package download failed!', $argq);
}
@ -123,6 +124,7 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa
if (file_check_sha1($pkg_file, $pkg_sha1))
logger($pkg_gitname.' package up to date, checksum ok.', $argq);
else{
if (file_exists($pkg_file))
unlink($pkg_file);
logger($pkg_gitname.' package checksum failed! package deleted.', $argq);
}