diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-10-28 09:07:40 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-10-28 10:13:35 +0200 |
commit | f722640a32a6c0a7fb0232abf8f57052d43d19c9 (patch) | |
tree | ea3d9e1def278a2d6d2c9164701840d87f573eff /lib | |
parent | e7ec4601a36c28ad2940c66b4baeadac5cc7863e (diff) | |
download | nextcloud-server-f722640a32a6c0a7fb0232abf8f57052d43d19c9.tar.gz nextcloud-server-f722640a32a6c0a7fb0232abf8f57052d43d19c9.zip |
Proper DI of config
* Fixed comments
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/Manager.php | 25 | ||||
-rw-r--r-- | lib/public/IUserManager.php | 5 |
2 files changed, 15 insertions, 15 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index f0488637485..c3fb8737420 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -72,7 +72,7 @@ class Manager extends PublicEmitter implements IUserManager { /** * @param \OCP\IConfig $config */ - public function __construct(IConfig $config = null) { + public function __construct(IConfig $config) { $this->config = $config; $cachedUsers = &$this->cachedUsers; $this->listen('\OC\User', 'postDelete', function ($user) use (&$cachedUsers) { @@ -389,25 +389,23 @@ class Manager extends PublicEmitter implements IUserManager { $queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $queryBuilder->select($queryBuilder->createFunction('COUNT(*)')) ->from('preferences') - ->where($queryBuilder->expr()->eq( - 'appid', $queryBuilder->createNamedParameter('login')) - ) - ->andWhere($queryBuilder->expr()->eq( - 'configkey', $queryBuilder->createNamedParameter('lastLogin')) - ) - ->andWhere($queryBuilder->expr()->isNotNull('configvalue') - ); + ->where($queryBuilder->expr()->eq('appid', $queryBuilder->createNamedParameter('login'))) + ->andWhere($queryBuilder->expr()->eq('configkey', $queryBuilder->createNamedParameter('lastLogin'))) + ->andWhere($queryBuilder->expr()->isNotNull('configvalue')); $query = $queryBuilder->execute(); - return (int)$query->fetchColumn(); + + $result = (int)$query->fetchColumn(); + $query->closeCursor(); + + return $result; } /** * @param \Closure $callback - * @param string $search * @since 9.2.0 */ - public function callForSeenUsers (\Closure $callback) { + public function callForSeenUsers(\Closure $callback) { $limit = 1000; $offset = 0; do { @@ -462,8 +460,11 @@ class Manager extends PublicEmitter implements IUserManager { $result[] = $row['userid']; } + $query->closeCursor(); + return $result; } + /** * @param string $email * @return IUser[] diff --git a/lib/public/IUserManager.php b/lib/public/IUserManager.php index 854622335c8..5220a0c65c7 100644 --- a/lib/public/IUserManager.php +++ b/lib/public/IUserManager.php @@ -142,7 +142,7 @@ interface IUserManager { * @param string $search * @since 9.0.0 */ - public function callForAllUsers (\Closure $callback, $search = ''); + public function callForAllUsers(\Closure $callback, $search = ''); /** * returns how many users have logged in once @@ -154,10 +154,9 @@ interface IUserManager { /** * @param \Closure $callback - * @param string $search * @since 9.2.0 */ - public function callForSeenUsers (\Closure $callback); + public function callForSeenUsers(\Closure $callback); /** * @param string $email |