From b315e8d58a7de0e47adcc18fdda97d1158bf7fb3 Mon Sep 17 00:00:00 2001 From: Fabrice Creuzot Date: Sun, 6 Nov 2022 12:49:05 +0100 Subject: [PATCH] Fix unlink no such file or directory --- lib/Varien/Io/File.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Varien/Io/File.php b/lib/Varien/Io/File.php index c78630bb73d..b4a5b2973aa 100644 --- a/lib/Varien/Io/File.php +++ b/lib/Varien/Io/File.php @@ -377,6 +377,7 @@ public function rmdir($dir, $recursive = false) */ public static function rmdirRecursive($dir, $recursive = true) { + $result = true; if ($recursive) { if (is_dir($dir)) { foreach (scandir($dir) as $item) { @@ -386,7 +387,7 @@ public static function rmdirRecursive($dir, $recursive = true) self::rmdirRecursive($dir . "/" . $item, $recursive); } $result = @rmdir($dir); - } else { + } elseif (file_exists($dir)) { $result = @unlink($dir); } } else {