Skip to content

Commit e4b68e4

Browse files
authored
Merge pull request #31521 from nextcloud/backport/31491/stable23
[stable23] Fix duplicated UUID detection when there are empty uuids
2 parents ea3a9ba + a737a25 commit e4b68e4

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

apps/user_ldap/lib/Mapping/AbstractMapping.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,14 @@ public function clearCb(callable $preCallback, callable $postCallback): bool {
438438
$picker = $this->dbc->getQueryBuilder();
439439
$picker->select('owncloud_name')
440440
->from($this->getTableName());
441-
$cursor = $picker->execute();
441+
$cursor = $picker->executeQuery();
442442
$result = true;
443-
while ($id = $cursor->fetchOne()) {
443+
while (($id = $cursor->fetchOne()) !== false) {
444444
$preCallback($id);
445445
if ($isUnmapped = $this->unmap($id)) {
446446
$postCallback($id);
447447
}
448-
$result &= $isUnmapped;
448+
$result = $result && $isUnmapped;
449449
}
450450
$cursor->closeCursor();
451451
return $result;

apps/user_ldap/lib/Migration/Version1130Date20211102154716.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ protected function getNextcloudIdsByUuid(string $table, string $uuid): array {
259259

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

280280
$result = $select->executeQuery();
281-
while ($uuid = $result->fetchOne()) {
281+
while (($uuid = $result->fetchOne()) !== false) {
282282
yield $uuid;
283283
}
284284
$result->closeCursor();

apps/workflowengine/lib/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ protected function canModify(int $id, ScopeContext $scopeContext):bool {
351351
$result = $qb->execute();
352352

353353
$this->operationsByScope[$scopeContext->getHash()] = [];
354-
while ($opId = $result->fetchOne()) {
354+
while (($opId = $result->fetchOne()) !== false) {
355355
$this->operationsByScope[$scopeContext->getHash()][] = (int)$opId;
356356
}
357357
$result->closeCursor();

apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function populateScopeTable(IResult $ids): void {
5757
$qb = $this->dbc->getQueryBuilder();
5858

5959
$insertQuery = $qb->insert('flow_operations_scope');
60-
while ($id = $ids->fetchOne()) {
60+
while (($id = $ids->fetchOne()) !== false) {
6161
$insertQuery->values(['operation_id' => $qb->createNamedParameter($id), 'type' => IManager::SCOPE_ADMIN]);
6262
$insertQuery->execute();
6363
}

0 commit comments

Comments
 (0)