From 2c3e6a245b615cb7180d418d8757681ecf8fbd77 Mon Sep 17 00:00:00 2001 From: Dillard Blom Date: Wed, 30 Sep 2026 13:32:40 +0200 Subject: [PATCH] fix(config): clear the old category cache on upgrade The old cache is only replaced when the categories are requested, so on instances that use a menu without categories the 170 KB app config value stayed and was still loaded on every request. A post-migration repair step clears it when the app is upgraded. --- CHANGELOG.md | 1 + appinfo/info.xml | 5 +++ lib/Migration/ClearCategoryCache.php | 46 ++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 lib/Migration/ClearCategoryCache.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 75ad263..4ddbed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - fix(config): store the app store category cache lazily with only the names in the languages in use, refresh it weekly and when the settings are saved, and load it only when categories are used - fix(admin): save all settings in one request so changes are not lost after the page reloads +- fix(config): remove the old category cache from the app config on upgrade ## 6.2.0 diff --git a/appinfo/info.xml b/appinfo/info.xml index 5ebaa54..91b95f4 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -55,6 +55,11 @@ In case of downtime, you can download **Custom Menu** from [here](https://kim.de + + + OCA\SideMenu\Migration\ClearCategoryCache + + OCA\SideMenu\Settings\Admin OCA\SideMenu\Settings\AdminSection diff --git a/lib/Migration/ClearCategoryCache.php b/lib/Migration/ClearCategoryCache.php new file mode 100644 index 0000000..df54327 --- /dev/null +++ b/lib/Migration/ClearCategoryCache.php @@ -0,0 +1,46 @@ +. + */ + +namespace OCA\SideMenu\Migration; + +use OCA\SideMenu\Service\CategoryRepository; +use OCP\Migration\IOutput; +use OCP\Migration\IRepairStep; + +/** + * Earlier versions stored the category cache as a regular app config + * value, which Nextcloud loads on every request. Clear it on upgrade so + * it does not linger on instances that never request the categories. + */ +class ClearCategoryCache implements IRepairStep +{ + public function __construct(protected CategoryRepository $categoryRepository) + { + } + + public function getName(): string + { + return 'Clear the category cache'; + } + + public function run(IOutput $output): void + { + $this->categoryRepository->clearCache(); + } +}