Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(dav): close cursor when fetching max id
Signed-off-by: Richard Steinmetz <[email protected]>
  • Loading branch information
st3iny committed Jul 11, 2023
commit 491eda93cc5d8b195ddc170db28beb11585761fd
4 changes: 3 additions & 1 deletion apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -3097,7 +3097,9 @@ public function pruneOutdatedSyncTokens(int $keep = 10_000): int {
$query->select($query->func()->max('id'))
->from('calendarchanges');

$maxId = $query->executeQuery()->fetchOne();
$result = $query->executeQuery();
$maxId = (int) $result->fetchOne();
$result->closeCursor();
if (!$maxId || $maxId < $keep) {
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,9 @@ public function pruneOutdatedSyncTokens(int $keep = 10_000): int {
$query->select($query->func()->max('id'))
->from('addressbookchanges');

$maxId = $query->executeQuery()->fetchOne();
$result = $query->executeQuery();
$maxId = (int) $result->fetchOne();
$result->closeCursor();
if (!$maxId || $maxId < $keep) {
return 0;
}
Expand Down