From 9f46f0fdd4aa915fab39f91c1e00c36162ecc445 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sat, 11 May 2024 15:37:18 +0200 Subject: [PATCH] functions.php: do not fail fail_unlink if the file does not exist --- inc/functions.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 61b85a96..be1eb73c 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -715,12 +715,18 @@ function file_unlink($path) { $debug['unlink'][] = $path; } - $ret = @unlink($path); + if (file_exists($path)) { + $ret = @unlink($path); + } else { + $ret = true; + } - if ($config['gzip_static']) { - $gzpath = "$path.gz"; + if ($config['gzip_static']) { + $gzpath = "$path.gz"; - @unlink($gzpath); + if (file_exists($gzpath)) { + @unlink($gzpath); + } } if (isset($config['purge']) && $path[0] != '/' && isset($_SERVER['HTTP_HOST'])) {