functions.php: do not fail fail_unlink if the file does not exist

This commit is contained in:
Zankaria 2024-05-11 15:37:18 +02:00
parent ba2daa88e6
commit 9f46f0fdd4

View File

@ -715,12 +715,18 @@ function file_unlink($path) {
$debug['unlink'][] = $path; $debug['unlink'][] = $path;
} }
$ret = @unlink($path); if (file_exists($path)) {
$ret = @unlink($path);
} else {
$ret = true;
}
if ($config['gzip_static']) { if ($config['gzip_static']) {
$gzpath = "$path.gz"; $gzpath = "$path.gz";
@unlink($gzpath); if (file_exists($gzpath)) {
@unlink($gzpath);
}
} }
if (isset($config['purge']) && $path[0] != '/' && isset($_SERVER['HTTP_HOST'])) { if (isset($config['purge']) && $path[0] != '/' && isset($_SERVER['HTTP_HOST'])) {