diff --git a/lib/Db/MemberRequest.php b/lib/Db/MemberRequest.php index c4c66598c..df29cd0db 100644 --- a/lib/Db/MemberRequest.php +++ b/lib/Db/MemberRequest.php @@ -194,12 +194,16 @@ public function promoteToOwner(Member $member): ?Member { try { $this->db->beginTransaction(); - $qb = $this->getMemberSelectSql(); + $qb = $this->getMemberSelectSql(null, false); $qb->limitToCircleId($member->getCircleId()); $qb->limitInt('level', Member::LEVEL_OWNER); - // forUpdate locks the owner row until transaction is commited, forcing concurrent + + // forUpdate() locks the owner row until transaction is commited, forcing concurrent // requests to wait and read the updated current owner, preventing multiple owners - $qb->forUpdate(); + // Not needed/supported on SQLite, which only allows one writer at a time anyway + if ($this->db->getDatabaseProvider() !== IDBConnection::PLATFORM_SQLITE) { + $qb->forUpdate(); + } try { $oldOwner = $this->getItemFromRequest($qb);