From 082d6d0beaeb3289cef770c83561efce65936760 Mon Sep 17 00:00:00 2001 From: XueSheng-GIT Date: Thu, 31 Oct 2024 07:08:03 +0100 Subject: [PATCH] Fix labeled version expiry Co-authored-by: Louis Signed-off-by: XueSheng-GIT --- lib/Versions/ExpireManager.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Versions/ExpireManager.php b/lib/Versions/ExpireManager.php index e4f63bb29..9f82e42d3 100644 --- a/lib/Versions/ExpireManager.php +++ b/lib/Versions/ExpireManager.php @@ -66,8 +66,11 @@ protected function getAutoExpireList(int $time, array $versions): array { while ($newInterval) { if ($nextInterval === -1 || $prevTimestamp > $nextInterval) { if ($version->getTimestamp() > $nextVersion) { - //distance between two version too small, mark to delete - $toDelete[] = $version; + // Do not expire versions with a label. + if (!($version instanceof IMetadataVersion) || $version->getMetadataValue('label') === null || $version->getMetadataValue('label') === '') { + //distance between two version too small, mark to delete + $toDelete[] = $version; + } } else { $nextVersion = $version->getTimestamp() - $step; $prevTimestamp = $version->getTimestamp();