Implement review feedback

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2021-09-13 11:01:35 +02:00
parent 358eaba7dd
commit 474a5b55d3
2 changed files with 5 additions and 5 deletions

View file

@ -34,8 +34,8 @@ class Version23000Date20210906132259 extends SimpleMigrationStep {
$table->addColumn('delete_after', Types::DATETIME, [
'notnull' => true,
]);
$table->addIndex(['hash'], 'ratelimit_hash_idx');
$table->addIndex(['delete_after'], 'ratelimit_delete_after_idx');
$table->addIndex(['hash'], 'ratelimit_hash');
$table->addIndex(['delete_after'], 'ratelimit_delete_after');
return $schema;
}

View file

@ -74,7 +74,7 @@ class DatabaseBackend implements IBackend {
$qb->delete(self::TABLE_NAME)
->where(
$qb->expr()->lte('delete_after', $qb->createNamedParameter($currentTime, IQueryBuilder::PARAM_DATE))
);
)
->executeStatement();
$qb = $this->dbConnection->getQueryBuilder();
@ -88,10 +88,10 @@ class DatabaseBackend implements IBackend {
);
$cursor = $qb->executeQuery();
$row = $cursor->fetch();
$row = $cursor->fetchOne();
$cursor->closeCursor();
return (int)$row['count'];
return (int)$row;
}
/**