Skip to content

Commit 7b2af86

Browse files
committed
Fixed #13116
1 parent 22a3487 commit 7b2af86

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Fixed an error that could occur when creating a database backup on MySQL and MariaDB. ([#12996](https://github.com/craftcms/cms/issues/12996))
2020
- Fixed a bug where Edit Category screens were including a Parent field, even if the category group’s Max Levels was set to `1`. ([#13097](https://github.com/craftcms/cms/discussions/13097))
2121
- Fixed a bug where the uploader’s user photo wasn’t always loading on Edit Asset pages.
22+
- Fixed a bug where the “Delete for site” bulk element action was deleting disabled elements and drafts across all sites. ([#13116](https://github.com/craftcms/cms/issues/13116))
2223

2324
## 4.4.7.1 - 2023-04-15
2425

src/services/Elements.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,8 @@ public function deleteElementsForSite(array $elements): void
20792079
// Separate the multi-site elements from the single-site elements
20802080
$multiSiteElementIds = $firstElement::find()
20812081
->id(array_map(fn(ElementInterface $element) => $element->id, $elements))
2082+
->status(null)
2083+
->drafts(null)
20822084
->siteId(['not', $firstElement->siteId])
20832085
->unique()
20842086
->select(['elements.id'])
@@ -2114,7 +2116,12 @@ public function deleteElementsForSite(array $elements): void
21142116

21152117
// Resave them
21162118
$this->resaveElements(
2117-
$firstElement::find()->id($multiSiteElementIds)->site('*')->unique(),
2119+
$firstElement::find()
2120+
->id($multiSiteElementIds)
2121+
->status(null)
2122+
->drafts(null)
2123+
->site('*')
2124+
->unique(),
21182125
true,
21192126
updateSearchIndex: false
21202127
);

0 commit comments

Comments
 (0)