From a0a8d74247f67a3dd0f291baf89972ff45fb3f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean=20Charles=20Del=C3=A9pine?= Date: Thu, 2 Jul 2026 17:33:46 +0200 Subject: [PATCH] fix(themes-catalog): rebuild themes.json from scratch on each reconfigure run ThemesCatalog::register() was purely additive: entries for themes/apps no longer present on disk were never removed, causing DeadSymlinkCleaner to repeatedly clean up stale symlinks that setupPackagedThemes() would then recreate from the stale catalog on the next run. Add ThemesCatalog::reset() and call it in HordeReconfigureFlow::run() before re-registering all currently installed horde-theme packages, so themes.json reflects only the current install state. --- src/HordeReconfigureFlow.php | 2 ++ src/ThemesCatalog.php | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/HordeReconfigureFlow.php b/src/HordeReconfigureFlow.php index c04e234..9af3b59 100644 --- a/src/HordeReconfigureFlow.php +++ b/src/HordeReconfigureFlow.php @@ -189,6 +189,8 @@ public function run(): int $mode, ); + $themesHandler->themesCatalog->reset(); + foreach ($hordeThemes as $theme) { // register [$vendorName, $packageName] = explode('/', $theme); diff --git a/src/ThemesCatalog.php b/src/ThemesCatalog.php index a04bad9..af74999 100644 --- a/src/ThemesCatalog.php +++ b/src/ThemesCatalog.php @@ -111,4 +111,15 @@ public function toArray(): array { return $this->catalog; } + + /** + * Clear the in-memory catalog before a full rebuild. + * + * Callers are expected to re-register all currently installed + * theme packages afterwards and call save(). + */ + public function reset(): void + { + $this->catalog = []; + } }