Skip to content

Commit

Permalink
Merge pull request #15705 from craftcms/bugfix/gc-hard-delete-structu…
Browse files Browse the repository at this point in the history
…res-adjustment

tweak to hard delete structures not linked to revisions
  • Loading branch information
brandonkelly committed Sep 11, 2024
2 parents 123e48a + d6bc1cb commit ed6e390
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Updated Twig to 3.14. ([#15704](https://github.com/craftcms/cms/issues/15704))
- Fixed a bug where soft-deleted structures weren’t getting hard-deleted via garbage collection. ([#15705](https://github.com/craftcms/cms/pull/15705))
- Fixed an RCE vulnerability.

## 4.12.1 - 2024-09-06
Expand Down
5 changes: 3 additions & 2 deletions src/services/Gc.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ private function _hardDeleteStructures(): void
->leftJoin(['r' => $revisionsTable], '[[r.canonicalId]] = coalesce([[e.canonicalId]],[[e.id]])')
->where([
'and',
['not', ['se.elementId' => null]],
$this->_hardDeleteCondition('s'),
[
'r.canonicalId' => null,
Expand All @@ -624,7 +625,7 @@ private function _hardDeleteStructures(): void
if ($this->db->getIsMysql()) {
$sql = <<<SQL
DELETE [[s]].* FROM $structuresTable [[s]]
WHERE [[s.id]] NOT IN ($ids)
WHERE [[s.id]] IN ($ids)
AND $conditionSql
SQL;
} else {
Expand All @@ -633,7 +634,7 @@ private function _hardDeleteStructures(): void
USING $structuresTable [[s]]
WHERE
$structuresTable.[[id]] = [[s.id]] AND
[[s.id]] NOT IN ($ids) AND
[[s.id]] IN ($ids) AND
$conditionSql
SQL;
}
Expand Down

0 comments on commit ed6e390

Please sign in to comment.