From b47311376453ba9ada66f888b7967661014358da Mon Sep 17 00:00:00 2001 From: umgfoin Date: Thu, 16 Jan 2025 15:54:41 +0100 Subject: [PATCH] Fix wrong failure-msg when clearing photo-cache. bool GeophotoService::clearCache returns false, if any of the cleared caches was already empty. Accordingly a failure-msg is shown in the maps-GUI. This change makes the function always return true unless an exception occurred - then false is returned. Signed-off-by: umgfoin --- lib/Service/GeophotoService.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/Service/GeophotoService.php b/lib/Service/GeophotoService.php index 2075539f7..1d88d9062 100644 --- a/lib/Service/GeophotoService.php +++ b/lib/Service/GeophotoService.php @@ -74,11 +74,16 @@ public function __construct( * @return bool */ public function clearCache(string $userId = ''): bool { - $a = $this->photosCache->clear($userId); - $b = $this->timeOrderedPointSetsCache->clear($userId); - $c = $this->backgroundJobCache->clear('recentlyAdded:'.$userId); - $d = $this->backgroundJobCache->clear('recentlyUpdated:'.$userId); - return $a and $b and $c and $d; + try { + $this->photosCache->clear($userId); + $this->timeOrderedPointSetsCache->clear($userId); + $this->backgroundJobCache->clear('recentlyAdded:'.$userId); + $this->backgroundJobCache->clear('recentlyUpdated:'.$userId); + return true; + + } catch (\Exception $e) { + return false; + } } /**