aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-07-04 10:39:38 +0200
committerGitHub <noreply@github.com>2024-07-04 10:39:38 +0200
commit8cb0f1a3ae62790152795b66e57a6e9dd67f5996 (patch)
tree5c74931e2ef506fd1d1cfbdac6349a94466885b5 /lib
parent0116a631c63013e22c6ba9a182ff722607bb0295 (diff)
parent8fc498fb820ed1459475eec98cfedb23161dd643 (diff)
downloadnextcloud-server-8cb0f1a3ae62790152795b66e57a6e9dd67f5996.tar.gz
nextcloud-server-8cb0f1a3ae62790152795b66e57a6e9dd67f5996.zip
Merge pull request #46174 from nextcloud/fix/integrity-check
fix(IntegrityCheck): Ensure the check is run if no results are available
Diffstat (limited to 'lib')
-rw-r--r--lib/private/IntegrityCheck/Checker.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php
index a6de3cf6030..d38ccf497f4 100644
--- a/lib/private/IntegrityCheck/Checker.php
+++ b/lib/private/IntegrityCheck/Checker.php
@@ -373,7 +373,7 @@ class Checker {
*/
public function hasPassedCheck(): bool {
$results = $this->getResults();
- if (empty($results)) {
+ if ($results !== null && empty($results)) {
return true;
}
@@ -381,15 +381,20 @@ class Checker {
}
/**
- * @return array
+ * @return array|null Either the results or null if no results available
*/
- public function getResults(): array {
+ public function getResults(): array|null {
$cachedResults = $this->cache->get(self::CACHE_KEY);
if (!\is_null($cachedResults) and $cachedResults !== false) {
return json_decode($cachedResults, true);
}
- return $this->appConfig?->getValueArray('core', self::CACHE_KEY, lazy: true) ?? [];
+ if ($this->appConfig?->hasKey('core', self::CACHE_KEY, lazy: true)) {
+ return $this->appConfig->getValueArray('core', self::CACHE_KEY, lazy: true);
+ }
+
+ // No results available
+ return null;
}
/**
@@ -399,7 +404,7 @@ class Checker {
* @param array $result
*/
private function storeResults(string $scope, array $result) {
- $resultArray = $this->getResults();
+ $resultArray = $this->getResults() ?? [];
unset($resultArray[$scope]);
if (!empty($result)) {
$resultArray[$scope] = $result;