Skip to content

Commit

Permalink
Fixed #13116
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Apr 24, 2023
1 parent 22a3487 commit 7b2af86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Fixed an error that could occur when creating a database backup on MySQL and MariaDB. ([#12996](https://github.com/craftcms/cms/issues/12996))
- 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))
- Fixed a bug where the uploader’s user photo wasn’t always loading on Edit Asset pages.
- 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))

## 4.4.7.1 - 2023-04-15

Expand Down
9 changes: 8 additions & 1 deletion src/services/Elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,8 @@ public function deleteElementsForSite(array $elements): void
// Separate the multi-site elements from the single-site elements
$multiSiteElementIds = $firstElement::find()
->id(array_map(fn(ElementInterface $element) => $element->id, $elements))
->status(null)
->drafts(null)
->siteId(['not', $firstElement->siteId])
->unique()
->select(['elements.id'])
Expand Down Expand Up @@ -2114,7 +2116,12 @@ public function deleteElementsForSite(array $elements): void

// Resave them
$this->resaveElements(
$firstElement::find()->id($multiSiteElementIds)->site('*')->unique(),
$firstElement::find()
->id($multiSiteElementIds)
->status(null)
->drafts(null)
->site('*')
->unique(),
true,
updateSearchIndex: false
);
Expand Down

0 comments on commit 7b2af86

Please sign in to comment.