Check if path exists before attempting to remove

This commit is contained in:
Joe Clark
2022-03-22 13:06:39 -07:00
parent e54eae13a7
commit 9a04ff5341

View File

@@ -39,6 +39,10 @@ function initials($str) {
} }
function removeDirectory($path) { function removeDirectory($path) {
if (!file_exists($path)) {
return;
}
$files = glob($path . '/*'); $files = glob($path . '/*');
foreach ($files as $file) { foreach ($files as $file) {
is_dir($file) ? removeDirectory($file) : unlink($file); is_dir($file) ? removeDirectory($file) : unlink($file);
@@ -396,4 +400,4 @@ function encryptUpgradeLoginEntry($login_password_cleartext, $site_encryption_ma
return $login_password_ciphertext; return $login_password_ciphertext;
} }
?> ?>