Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak to hard delete structures not linked to revisions #15705

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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