diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2013-04-17 03:06:50 -0700 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2013-04-17 03:06:50 -0700 |
commit | ec280e6f9f43e2f1d74c9ddf1e0fd64aabddc25f (patch) | |
tree | 88f2dcca54f95bf93f8c1748678152418fc5a6a4 /lib | |
parent | ddde1b65db36507b30aa42e991c9b50312f7c97f (diff) | |
parent | fa8214ecc99ff8de41b748edffed1f11155e53f8 (diff) | |
download | nextcloud-server-ec280e6f9f43e2f1d74c9ddf1e0fd64aabddc25f.tar.gz nextcloud-server-ec280e6f9f43e2f1d74c9ddf1e0fd64aabddc25f.zip |
Merge pull request #2746 from owncloud/use-count-userexists
Use count SQL to check for user existance
Diffstat (limited to 'lib')
-rw-r--r-- | lib/user/database.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/user/database.php b/lib/user/database.php index 210c7f3e1eb..ea938790d22 100644 --- a/lib/user/database.php +++ b/lib/user/database.php @@ -237,13 +237,13 @@ class OC_User_Database extends OC_User_Backend { * @return boolean */ public function userExists($uid) { - $query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)' ); + $query = OC_DB::prepare( 'SELECT COUNT(*) FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)' ); $result = $query->execute( array( $uid )); if (OC_DB::isError($result)) { OC_Log::write('core', OC_DB::getErrorMessage($result), OC_Log::ERROR); return false; } - return $result->numRows() > 0; + return $result->fetchOne() > 0; } /** |