aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Security
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-09-13 10:43:01 +0200
committerGitHub <noreply@github.com>2021-09-13 10:43:01 +0200
commit358eaba7dd45e5c5dbce44011bd7eadd88fe8534 (patch)
tree46799ecf5a1f46f6f90266bed81075d5f22073fb /lib/private/Security
parent471167019c7c9071fa815b2c92691f65370a43b9 (diff)
downloadnextcloud-server-358eaba7dd45e5c5dbce44011bd7eadd88fe8534.tar.gz
nextcloud-server-358eaba7dd45e5c5dbce44011bd7eadd88fe8534.zip
Apply suggestions from code review
Signed-off-by: Lukas Reschke <lukas@statuscode.ch> Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Diffstat (limited to 'lib/private/Security')
-rw-r--r--lib/private/Security/RateLimiting/Backend/DatabaseBackend.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php b/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php
index 2ba6dc73c47..5f579bfef85 100644
--- a/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php
+++ b/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php
@@ -73,21 +73,19 @@ class DatabaseBackend implements IBackend {
$qb = $this->dbConnection->getQueryBuilder();
$qb->delete(self::TABLE_NAME)
->where(
- $qb->expr()->lte('delete_after', $qb->createParameter('currentTime'))
- )
- ->setParameter('currentTime', $currentTime, 'datetime')
+ $qb->expr()->lte('delete_after', $qb->createNamedParameter($currentTime, IQueryBuilder::PARAM_DATE))
+ );
->executeStatement();
$qb = $this->dbConnection->getQueryBuilder();
- $qb->selectAlias($qb->createFunction('COUNT(*)'), 'count')
+ $qb->select($qb->func()->count())
->from(self::TABLE_NAME)
->where(
$qb->expr()->eq('hash', $qb->createNamedParameter($identifier, IQueryBuilder::PARAM_STR))
)
->andWhere(
- $qb->expr()->gte('delete_after', $qb->createParameter('currentTime'))
- )
- ->setParameter('currentTime', $currentTime, 'datetime');
+ $qb->expr()->gte('delete_after', $qb->createNamedParameter($currentTime, IQueryBuilder::PARAM_DATE))
+ );
$cursor = $qb->executeQuery();
$row = $cursor->fetch();