From 23140022ad2a1cc13f45890ba48b7283bb581ca2 Mon Sep 17 00:00:00 2001 From: Lauri Eskola <lauri.eskola@acquia.com> Date: Wed, 19 Jul 2023 16:13:17 +0300 Subject: [PATCH] Issue #3374319 by catch, longwave: FileSystem::deleteRecursive() shouldn't log a message when it tries to delete a non-existent directory (cherry picked from commit e983ee9d89f4c9c6a124e20d3276e2b902d5e727) --- core/lib/Drupal/Core/File/FileSystem.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/lib/Drupal/Core/File/FileSystem.php b/core/lib/Drupal/Core/File/FileSystem.php index 5947d00c4f0f..c82d61fbe351 100644 --- a/core/lib/Drupal/Core/File/FileSystem.php +++ b/core/lib/Drupal/Core/File/FileSystem.php @@ -354,6 +354,10 @@ public function deleteRecursive($path, callable $callback = NULL) { call_user_func($callback, $path); } + if (!file_exists($path)) { + return TRUE; + } + if (is_dir($path)) { $dir = dir($path); while (($entry = $dir->read()) !== FALSE) { -- GitLab