summaryrefslogtreecommitdiffstats
path: root/lib/private/files/cache
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-09-10 22:01:02 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-09-15 10:18:32 +0200
commit5ca690e2f8be9fae50a6d29786ab0da9188a71ad (patch)
treed83c6f473bf0f583b2076f68b552835db9862bc4 /lib/private/files/cache
parent24d2cbf3de49dab44978061b33d0580d24d89d58 (diff)
downloadnextcloud-server-5ca690e2f8be9fae50a6d29786ab0da9188a71ad.tar.gz
nextcloud-server-5ca690e2f8be9fae50a6d29786ab0da9188a71ad.zip
Use integer for availability instead of bool
Diffstat (limited to 'lib/private/files/cache')
-rw-r--r--lib/private/files/cache/storage.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php
index 338d8308281..a116e84b3f2 100644
--- a/lib/private/files/cache/storage.php
+++ b/lib/private/files/cache/storage.php
@@ -58,7 +58,8 @@ class Storage {
$this->numericId = $row['numeric_id'];
} else {
$connection = \OC_DB::getConnection();
- if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $isAvailable])) {
+ $available = $isAvailable ? 1 : 0;
+ if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) {
$this->numericId = \OC_DB::insertid('*PREFIX*storages');
} else {
if ($row = self::getStorageById($this->storageId)) {
@@ -141,7 +142,7 @@ class Storage {
public function getAvailability() {
if ($row = self::getStorageById($this->storageId)) {
return [
- 'available' => $row['available'],
+ 'available' => ($row['available'] === 1),
'last_checked' => $row['last_checked']
];
} else {
@@ -154,7 +155,8 @@ class Storage {
*/
public function setAvailability($isAvailable) {
$sql = 'UPDATE `*PREFIX*storages` SET `available` = ?, `last_checked` = ? WHERE `id` = ?';
- \OC_DB::executeAudited($sql, array($isAvailable, time(), $this->storageId));
+ $available = $isAvailable ? 1 : 0;
+ \OC_DB::executeAudited($sql, array($available, time(), $this->storageId));
}
/**