From 587fa2602771e2c9afac540aaca2f37639be89c7 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 27 Mar 2024 05:22:43 +0200 Subject: [PATCH] fix snap cleanup rules --- src/cli/document/clean.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cli/document/clean.php b/src/cli/document/clean.php index 67d7c52..12eb3fd 100644 --- a/src/cli/document/clean.php +++ b/src/cli/document/clean.php @@ -123,9 +123,17 @@ foreach ($config->cli->document->crawl->skip->stripos->url as $condition) if (is_dir($location)) { - if (rmdir($location)) + foreach ((array) scandir($location) as $filename) { - $snaps++; + if (is_dir($filename) || is_link($filename) || str_starts_with($filename, '.') || !str_ends_with($filename, '.tar.gz')) + { + continue; + } + + if (unlink($filename)) + { + $snaps++; + } } }