From 4ae10aa7f95e11608d465b3c58d7a88c48cbfbf5 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Fri, 20 Sep 2024 18:14:33 +0200 Subject: [PATCH] fix(profiler): clear command does not work - The loop is supposed to delete the files first and then the directories. - getPathInfo returns a SplFileInfo object for the parent (the folder in our case). - A non-empty directory cannot be deleted. Signed-off-by: Daniel Kesselberg --- lib/private/Profiler/FileProfilerStorage.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/Profiler/FileProfilerStorage.php b/lib/private/Profiler/FileProfilerStorage.php index a4021d064a9..cd45090e7ca 100644 --- a/lib/private/Profiler/FileProfilerStorage.php +++ b/lib/private/Profiler/FileProfilerStorage.php @@ -81,11 +81,11 @@ class FileProfilerStorage { $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $file) { - $file = (string)$file->getPathInfo(); - if (is_file($file)) { - unlink($file); + $path = $file->getPathname(); + if (is_file($path)) { + unlink($path); } else { - rmdir($file); + rmdir($path); } } } -- 2.39.5