From 6be43da94935985ab42761bfb6709689ad1f93e6 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 24 Dec 2015 13:33:19 +0100 Subject: [PATCH] Add missing box menuID update after menu installation --- .../MenuPackageInstallationPlugin.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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']); -- 2.20.1