Skip to content

Commit

Permalink
Merge pull request #1843 from nextcloud/backport/1837/stable27
Browse files Browse the repository at this point in the history
[stable27] fix: use owner instead of owner_id to delete photos by owner
  • Loading branch information
artonge authored Jun 13, 2023
2 parents d9f946e + 1a1b612 commit 81afd13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Album/AlbumMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ public function removeFileWithOwner(int $fileId, string $ownerId): void {
$query = $this->connection->getQueryBuilder();
$albumsRows = $query->select('album_id')
->from("photos_albums_files")
->where($query->expr()->eq("owner_id", $query->createNamedParameter($ownerId)))
->where($query->expr()->eq("owner", $query->createNamedParameter($ownerId)))
->andWhere($query->expr()->eq("file_id", $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)))
->executeQuery()
->fetchAll();

// Remove any occurrence of fileId when owner is ownerId.
$query = $this->connection->getQueryBuilder();
$query->delete("photos_albums_files")
->where($query->expr()->eq("owner_id", $query->createNamedParameter($ownerId)))
->where($query->expr()->eq("owner", $query->createNamedParameter($ownerId)))
->andWhere($query->expr()->eq("file_id", $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)))
->executeStatement();

Expand Down

0 comments on commit 81afd13

Please sign in to comment.