Skip to content

Commit

Permalink
Merge pull request #1375 from umgfoin/PR_fix_wrong_photocache_failure…
Browse files Browse the repository at this point in the history
…-msg

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.
  • Loading branch information
umgfoin authored Jan 19, 2025
2 parents a0cfc6b + 79bd524 commit 8601242
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.6.0 - 2025.01.10 Georeferenced photos from external folders not shown on map
## 1.6.0 - [unreleased]
### Added
- Scan photos of specific directory [#1231](https://github.com/nextcloud/maps/pull/1231) @tetebueno

### Fixed
- Georeferenced photos from external folders not shown on map
[#1371](https://github.com/nextcloud/maps/issues/1371) @umgfoin
- Fix wrong failure-msg. when clearing photo-cache
[#1375](https://github.com/nextcloud/maps/pull/1375) @umgfoin


## 1.5.0 - 2024.11.16 Nextcloud Hub 9
Expand Down
15 changes: 10 additions & 5 deletions lib/Service/GeophotoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

/**
Expand Down

0 comments on commit 8601242

Please sign in to comment.