From 3da85d6cf70b1229be6002bdad7e0f181a20de78 Mon Sep 17 00:00:00 2001 From: Jellyfrog Date: Wed, 11 Jun 2025 18:31:32 +0200 Subject: [PATCH] [12.x] Check if file exists before trying to delete it This avoids the warning "No such file or directory" if the file doesn't exist. ``` $ php artisan config:clear unlink(/home/jellyfrog/code/librenms/bootstrap/cache/config.php): No such file or directory in /home/jellyfrog/code/librenms/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 308 INFO Configuration cache cleared successfully. ``` --- src/Illuminate/Filesystem/Filesystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Filesystem/Filesystem.php b/src/Illuminate/Filesystem/Filesystem.php index 38e5a5448c9d..3ff4d9ca5fb5 100644 --- a/src/Illuminate/Filesystem/Filesystem.php +++ b/src/Illuminate/Filesystem/Filesystem.php @@ -305,7 +305,7 @@ public function delete($paths) foreach ($paths as $path) { try { - if (@unlink($path)) { + if (is_file($path) && @unlink($path)) { clearstatcache(false, $path); } else { $success = false;