diff options
author | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2015-01-23 21:53:21 +0000 |
---|---|---|
committer | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2015-07-20 16:27:26 +0100 |
commit | df19cabb44f9106484290a269ef6d4cb07b059d7 (patch) | |
tree | f3246817578ed3fc91c1bb05051582ac4386defd /lib/private/files/storage/common.php | |
parent | 89d6439445da8e1cf133bc2e1b6db9709ce4af8b (diff) | |
download | nextcloud-server-df19cabb44f9106484290a269ef6d4cb07b059d7.tar.gz nextcloud-server-df19cabb44f9106484290a269ef6d4cb07b059d7.zip |
Store storage availability in database
Storage status is saved in the database. Failed storages are rechecked every
10 minutes, while working storages are rechecked every request.
Using the files_external app will recheck all external storages when the
settings page is viewed, or whenever an external storage is saved.
Diffstat (limited to 'lib/private/files/storage/common.php')
-rw-r--r-- | lib/private/files/storage/common.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 847cb8492fe..d006f1fb486 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -404,6 +404,11 @@ abstract class Common implements Storage { return implode('/', $output); } + /** + * Test a storage for availability + * + * @return bool + */ public function test() { if ($this->stat('')) { return true; @@ -650,4 +655,18 @@ abstract class Common implements Storage { public function changeLock($path, $type, ILockingProvider $provider) { $provider->changeLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); } + + /** + * @return array [ available, last_checked ] + */ + public function getAvailability() { + return $this->getStorageCache()->getAvailability(); + } + + /** + * @param bool $isAvailable + */ + public function setAvailability($isAvailable) { + $this->getStorageCache()->setAvailability($isAvailable); + } } |