Merge pull request #2746 from owncloud/use-count-userexists
Use count SQL to check for user existance
This commit is contained in:
commit
ec280e6f9f
|
@ -237,13 +237,13 @@ class OC_User_Database extends OC_User_Backend {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function userExists($uid) {
|
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 ));
|
$result = $query->execute( array( $uid ));
|
||||||
if (OC_DB::isError($result)) {
|
if (OC_DB::isError($result)) {
|
||||||
OC_Log::write('core', OC_DB::getErrorMessage($result), OC_Log::ERROR);
|
OC_Log::write('core', OC_DB::getErrorMessage($result), OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $result->numRows() > 0;
|
return $result->fetchOne() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue