From cfd23bc01e5a741353f339299efc105c713c0f20 Mon Sep 17 00:00:00 2001 From: Jonas Sulzer Date: Thu, 10 Jan 2019 23:22:24 +0100 Subject: [PATCH] use \OC::$server->getDatabaseConnection()->executeQuery() with fetch() where possible Signed-off-by: Jonas Sulzer --- lib/base.php | 8 ++++---- lib/imap.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/base.php b/lib/base.php index 8f2be81..39830a9 100644 --- a/lib/base.php +++ b/lib/base.php @@ -55,11 +55,11 @@ abstract class Base extends \OC\User\Backend{ * @return string display name */ public function getDisplayName($uid) { - $user = OC_DB::executeAudited( + $user = \OC::$server->getDatabaseConnection()->executeQuery( 'SELECT `displayname` FROM `*PREFIX*users_external`' . ' WHERE `uid` = ? AND `backend` = ?', array($uid, $this->backend) - )->fetchRow(); + )->fetch(); $displayName = trim($user['displayname'], ' '); if (!empty($displayName)) { return $displayName; @@ -170,11 +170,11 @@ abstract class Base extends \OC\User\Backend{ * @return boolean */ public function userExists($uid) { - $result = OC_DB::executeAudited( + $result = \OC::$server->getDatabaseConnection()->executeQuery( 'SELECT COUNT(*) FROM `*PREFIX*users_external`' . ' WHERE LOWER(`uid`) = LOWER(?) AND `backend` = ?', array($uid, $this->backend) ); - return $result->fetchOne() > 0; + return $result->fetch() > 0; } } diff --git a/lib/imap.php b/lib/imap.php index a236290..cf96cbf 100644 --- a/lib/imap.php +++ b/lib/imap.php @@ -52,13 +52,13 @@ class OC_User_IMAP extends \OCA\user_external\Base { $uid = str_replace("%40","@",$uid); } - $result = OC_DB::executeAudited( + $result = \OC::$server->getDatabaseConnection()->executeQuery( 'SELECT `userid` FROM `*PREFIX*preferences` WHERE `appid`=? AND `configkey`=? AND `configvalue`=?', array('settings','email',$uid) ); $users = array(); - while ($row = $result->fetchRow()) { + while ($row = $result->fetch()) { $users[] = $row['userid']; }