From: Alexander Ebert Date: Sun, 18 Mar 2018 14:29:48 +0000 (+0100) Subject: Cleaning up embedded objects on box delete X-Git-Tag: 3.1.2~2^2~44 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=009147f6af12d0d3ea9ca6cd28e1cf581d5ae7e2;p=GitHub%2FWoltLab%2FWCF.git Cleaning up embedded objects on box delete --- diff --git a/wcfsetup/install/files/lib/data/box/BoxAction.class.php b/wcfsetup/install/files/lib/data/box/BoxAction.class.php index 72b768bf39..4313253aab 100644 --- a/wcfsetup/install/files/lib/data/box/BoxAction.class.php +++ b/wcfsetup/install/files/lib/data/box/BoxAction.class.php @@ -228,17 +228,25 @@ class BoxAction extends AbstractDatabaseObjectAction { * @inheritDoc */ public function delete() { + $boxContentIDs = []; foreach ($this->getObjects() as $box) { - if ($box->boxType == 'tpl') { - foreach ($box->getBoxContents() as $languageID => $content) { + foreach ($box->getBoxContents() as $languageID => $content) { + if ($box->boxType == 'tpl') { $file = WCF_DIR . 'templates/' . $box->getTplName(($languageID ?: null)) . '.tpl'; if (file_exists($file)) { @unlink($file); } } + + $boxContentIDs[] = $content->boxContentID; } } + if (!empty($boxContentIDs)) { + // update embedded objects + MessageEmbeddedObjectManager::getInstance()->removeObjects('com.woltlab.wcf.box.content', $boxContentIDs); + } + parent::delete(); }