diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-15 13:24:55 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-15 13:24:55 +0200 |
commit | e82a225d0440738a629f490c6f38e8cdc7f772c5 (patch) | |
tree | 3c95b0fc19930314783d0c87c09d432b245dadba /lib | |
parent | b6fe5b6f3c5204b765600509b28478fdfea3997b (diff) | |
parent | 5ca690e2f8be9fae50a6d29786ab0da9188a71ad (diff) | |
download | nextcloud-server-e82a225d0440738a629f490c6f38e8cdc7f772c5.tar.gz nextcloud-server-e82a225d0440738a629f490c6f38e8cdc7f772c5.zip |
Merge pull request #18964 from owncloud/availability-integer
Use integer for availability instead of bool
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/cache/storage.php | 8 |
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)); } /** |