From: Matthias Schmidt Date: Thu, 24 Dec 2015 12:33:19 +0000 (+0100) Subject: Add missing box menuID update after menu installation X-Git-Tag: 3.0.0_Beta_1~2030^2~203 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6be43da94935985ab42761bfb6709689ad1f93e6;p=GitHub%2FWoltLab%2FWCF.git Add missing box menuID update after menu installation --- diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php index 7fa9572f3e..76ae7eedb0 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php @@ -4,6 +4,7 @@ use wcf\data\box\Box; use wcf\data\box\BoxEditor; use wcf\data\menu\Menu; use wcf\data\menu\MenuEditor; +use wcf\data\menu\MenuList; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\SystemException; use wcf\system\WCF; @@ -189,7 +190,22 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $boxes[$box->identifier] = $box; } + // fetch all menus relevant + $menuList = new MenuList(); + $menuList->getConditionBuilder()->add('identifier IN (?)', [array_keys($this->boxData)]); + $menuList->readObjects(); + + $menus = []; + foreach ($menuList as $menu) { + $menus[$menu->identifier] = $menu; + } + foreach ($this->boxData as $identifier => $data) { + // connect box with menu + if (isset($menus[$identifier])) { + $data['menuID'] = $menus[$identifier]->menuID; + } + if (isset($boxes[$identifier])) { // skip both 'identifier' and 'packageID' as these properties are immutable unset($data['identifier']);