introduce callForSeenUsers and countSeenUsers#1888
Conversation
|
@MorrisJobke, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rullzer, @PVince81 and @DeepDiver1975 to be potential reviewers. |
|
cc @icewind1991 |
|
I like it. |
lib/private/User/Manager.php
Outdated
| ); | ||
|
|
||
| $query = $queryBuilder->execute(); | ||
| return (int)$query->fetchColumn(); |
There was a problem hiding this comment.
Missing $query->closeCursor()
lib/private/User/Manager.php
Outdated
| 'appid', $queryBuilder->createNamedParameter('login')) | ||
| ) | ||
| ->andWhere($queryBuilder->expr()->eq( | ||
| 'configkey', $queryBuilder->createNamedParameter('lastLogin')) |
There was a problem hiding this comment.
code style is odd in here
lib/private/User/Manager.php
Outdated
|
|
||
| /** | ||
| * @param \Closure $callback | ||
| * @param string $search |
| * @return string[] with user ids | ||
| */ | ||
| private function getSeenUserIds($limit = null, $offset = null) { | ||
| $queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder(); |
There was a problem hiding this comment.
Nah that will cause the DB to be initialized to early. So then installing fails. We should fix that at some point. But probabaly can't right now.
| * @since 9.2.0 | ||
| */ | ||
| public function countSeenUsers() { | ||
| $queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder(); |
|
|
||
| while ($row = $query->fetch()) { | ||
| $result[] = $row['userid']; | ||
| } |
There was a problem hiding this comment.
Missing $query->closeCursor()
|
|
||
| return $result; | ||
| } | ||
| /** |
| * @param \Closure $callback | ||
| * @param string $search | ||
| * @since 9.2.0 | ||
| */ |
lib/private/User/Manager.php
Outdated
| * @param string $search | ||
| * @since 9.2.0 | ||
| */ | ||
| public function callForSeenUsers (\Closure $callback) { |
* introduce callForSeenUsers and countSeenUsers * add tests * oracle should support not null on clob * since 9.2.0
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
| public function countSeenUsers(); | ||
|
|
||
| /** | ||
| * @param \Closure $callback |
* Fixed comments Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
d186f31 to
f722640
Compare
|
I fixed most of the comments. Injecting the DB here fails hard as it gets initialized to early then. I say lets get this in. 👍 |
|
Fine by me, also tested with the announcement center 👍 |
cc @rullzer @nickvergessen @schiessle
I will create a ticket to check our codebase for similar usages.