From 5ca690e2f8be9fae50a6d29786ab0da9188a71ad Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Thu, 10 Sep 2015 22:01:02 +0100 Subject: Use integer for availability instead of bool --- lib/private/files/cache/storage.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/private/files') 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)); } /** -- cgit v1.2.3