aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-04 15:29:17 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-04 15:29:17 +0100
commitb56dbd06077dd93a7df915a1827afd4781daa547 (patch)
treec4d2c5f013afe5c1bccd1f1fa32970bfc319ce16 /lib/private
parent8be6054e5ce8aeffd6e305317e57e2747f7909ea (diff)
parent4255dd2b396050e757f77db86063f0f1420a87d5 (diff)
downloadnextcloud-server-b56dbd06077dd93a7df915a1827afd4781daa547.tar.gz
nextcloud-server-b56dbd06077dd93a7df915a1827afd4781daa547.zip
Merge pull request #22816 from owncloud/external-unavailable-recheck
allow availability recheck for external storages
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/storage/wrapper/availability.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/private/files/storage/wrapper/availability.php b/lib/private/files/storage/wrapper/availability.php
index 55ddb0d5e8f..0ed31ba854a 100644
--- a/lib/private/files/storage/wrapper/availability.php
+++ b/lib/private/files/storage/wrapper/availability.php
@@ -29,6 +29,16 @@ namespace OC\Files\Storage\Wrapper;
class Availability extends Wrapper {
const RECHECK_TTL_SEC = 600; // 10 minutes
+ public static function shouldRecheck($availability) {
+ if (!$availability['available']) {
+ // trigger a recheck if TTL reached
+ if ((time() - $availability['last_checked']) > self::RECHECK_TTL_SEC) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* @return bool
*/
@@ -47,11 +57,8 @@ class Availability extends Wrapper {
*/
private function isAvailable() {
$availability = $this->getAvailability();
- if (!$availability['available']) {
- // trigger a recheck if TTL reached
- if ((time() - $availability['last_checked']) > self::RECHECK_TTL_SEC) {
- return $this->updateAvailability();
- }
+ if (self::shouldRecheck($availability)) {
+ return $this->updateAvailability();
}
return $availability['available'];
}