Skip to content

Commit

Permalink
Merge pull request #31521 from nextcloud/backport/31491/stable23
Browse files Browse the repository at this point in the history
[stable23] Fix duplicated UUID detection when there are empty uuids
  • Loading branch information
blizzz authored Apr 14, 2022
2 parents ea3a9ba + a737a25 commit e4b68e4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions apps/user_ldap/lib/Mapping/AbstractMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,14 @@ public function clearCb(callable $preCallback, callable $postCallback): bool {
$picker = $this->dbc->getQueryBuilder();
$picker->select('owncloud_name')
->from($this->getTableName());
$cursor = $picker->execute();
$cursor = $picker->executeQuery();
$result = true;
while ($id = $cursor->fetchOne()) {
while (($id = $cursor->fetchOne()) !== false) {
$preCallback($id);
if ($isUnmapped = $this->unmap($id)) {
$postCallback($id);
}
$result &= $isUnmapped;
$result = $result && $isUnmapped;
}
$cursor->closeCursor();
return $result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ protected function getNextcloudIdsByUuid(string $table, string $uuid): array {

$result = $select->executeQuery();
$idList = [];
while ($id = $result->fetchOne()) {
while (($id = $result->fetchOne()) !== false) {
$idList[] = $id;
}
$result->closeCursor();
Expand All @@ -278,7 +278,7 @@ protected function getDuplicatedUuids(string $table): Generator {
->having($select->expr()->gt($select->func()->count('owncloud_name'), $select->createNamedParameter(1)));

$result = $select->executeQuery();
while ($uuid = $result->fetchOne()) {
while (($uuid = $result->fetchOne()) !== false) {
yield $uuid;
}
$result->closeCursor();
Expand Down
2 changes: 1 addition & 1 deletion apps/workflowengine/lib/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ protected function canModify(int $id, ScopeContext $scopeContext):bool {
$result = $qb->execute();

$this->operationsByScope[$scopeContext->getHash()] = [];
while ($opId = $result->fetchOne()) {
while (($opId = $result->fetchOne()) !== false) {
$this->operationsByScope[$scopeContext->getHash()][] = (int)$opId;
}
$result->closeCursor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function populateScopeTable(IResult $ids): void {
$qb = $this->dbc->getQueryBuilder();

$insertQuery = $qb->insert('flow_operations_scope');
while ($id = $ids->fetchOne()) {
while (($id = $ids->fetchOne()) !== false) {
$insertQuery->values(['operation_id' => $qb->createNamedParameter($id), 'type' => IManager::SCOPE_ADMIN]);
$insertQuery->execute();
}
Expand Down

0 comments on commit e4b68e4

Please sign in to comment.