summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2013-04-17 03:06:50 -0700
committerThomas Tanghus <thomas@tanghus.net>2013-04-17 03:06:50 -0700
commitec280e6f9f43e2f1d74c9ddf1e0fd64aabddc25f (patch)
tree88f2dcca54f95bf93f8c1748678152418fc5a6a4 /lib
parentddde1b65db36507b30aa42e991c9b50312f7c97f (diff)
parentfa8214ecc99ff8de41b748edffed1f11155e53f8 (diff)
downloadnextcloud-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.php4
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;
}
/**