From 0b57bb4578be3b60c0b1f77dd7fa926aceed4461 Mon Sep 17 00:00:00 2001 From: Oleksandr Piskun Date: Fri, 23 Oct 2026 12:58:56 +0000 Subject: [PATCH] fix(harp): require HaRP 0.4.8 in the version check Signed-off-by: Oleksandr Piskun --- lib/AppInfo/Application.php | 2 +- lib/SetupChecks/HarpVersionCheck.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index a47c1be0c..09931861a 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -43,7 +43,7 @@ class Application extends App implements IBootstrap { public const APP_ID = 'app_api'; public const TEST_DEPLOY_APPID = 'test-deploy'; public const TEST_DEPLOY_INFO_XML = 'https://raw.githubusercontent.com/nextcloud/test-deploy/main/appinfo/info.xml'; - public const MINIMUM_HARP_VERSION = '0.3.0'; + public const MINIMUM_HARP_VERSION = '0.4.8'; public function __construct(array $urlParams = []) { parent::__construct(self::APP_ID, $urlParams); diff --git a/lib/SetupChecks/HarpVersionCheck.php b/lib/SetupChecks/HarpVersionCheck.php index fd7afc4b1..2dc25b0a3 100644 --- a/lib/SetupChecks/HarpVersionCheck.php +++ b/lib/SetupChecks/HarpVersionCheck.php @@ -91,12 +91,13 @@ private function fulfillsMinimumVersionRequirement(string $version): bool { } private function getHarpVersion(DaemonConfig $daemonConfig): ?string { - $cacheKey = $daemonConfig->getName() . '_' . (string)crc32(json_encode($daemonConfig)); + // With the minimum in the key, a version cached against an older minimum is asked again. + $cacheKey = $daemonConfig->getName() . '_' . (string)crc32(json_encode($daemonConfig)) . '_' . Application::MINIMUM_HARP_VERSION; $version = $this->cache?->get($cacheKey); if ($version === null) { $version = $this->harpService->getHarpVersion($daemonConfig); - $oneWeek = 60 * 60 * 24 * 7; - $this->cache?->set($cacheKey, $version, $oneWeek); + $ttl = $version !== null && $this->fulfillsMinimumVersionRequirement($version) ? 60 * 60 * 24 * 7 : 60 * 60; + $this->cache?->set($cacheKey, $version, $ttl); } return $version; }