Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-01-31 19:36:02 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-01-31 19:36:02 +0300
commitef188de2979105991df717eb4afa6ff1db242d07 (patch)
treec68447ab11cbdc26f1535d7046ea7b6384652bde
parent78c7e6f2c5609122d047a36fc44390b42a341566 (diff)
clear the cached storage info after it was flagged unavailablefix/noid/smb-unavailable-background-scan
so that follow up operations against this one do not try to reauth and cause lock outs Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r--lib/private/Files/Cache/Storage.php1
-rw-r--r--lib/private/Files/Cache/StorageGlobal.php6
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php
index 13af41acfea..263e0bac9c0 100644
--- a/lib/private/Files/Cache/Storage.php
+++ b/lib/private/Files/Cache/Storage.php
@@ -173,6 +173,7 @@ class Storage {
$sql = 'UPDATE `*PREFIX*storages` SET `available` = ?, `last_checked` = ? WHERE `id` = ?';
$available = $isAvailable ? 1 : 0;
\OC_DB::executeAudited($sql, [$available, time() + $delay, $this->storageId]);
+ self::getGlobalCache()->clearStorageInfo($this->storageId);
}
/**
diff --git a/lib/private/Files/Cache/StorageGlobal.php b/lib/private/Files/Cache/StorageGlobal.php
index 26a7be24634..223eeaa53a3 100644
--- a/lib/private/Files/Cache/StorageGlobal.php
+++ b/lib/private/Files/Cache/StorageGlobal.php
@@ -85,4 +85,10 @@ class StorageGlobal {
public function clearCache() {
$this->cache = [];
}
+
+ public function clearStorageInfo(string $storageId) {
+ if(isset($this->cache[$storageId])) {
+ unset($this->cache[$storageId]);
+ }
+ }
}