mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 16:44:39 +00:00
MVC / MenuInitException - handle broken menu xml files more gracefully, dump to error log, but don't crash out with a fatal exception.
This commit is contained in:
parent
53b8f0f8f0
commit
22f939bb8d
@ -97,7 +97,6 @@ class MenuController extends ApiControllerBase
|
||||
* request user context sensitive menu (items)
|
||||
* @param string $selected_uri selected uri
|
||||
* @return array menu items
|
||||
* @throws Menu\MenuInitException when unable to construct menu
|
||||
*/
|
||||
private function getMenu($selected_uri)
|
||||
{
|
||||
@ -166,7 +165,6 @@ class MenuController extends ApiControllerBase
|
||||
/**
|
||||
* return menu items for this user
|
||||
* @return array
|
||||
* @throws Menu\MenuInitException when unable to construct menu
|
||||
*/
|
||||
public function treeAction()
|
||||
{
|
||||
@ -178,7 +176,6 @@ class MenuController extends ApiControllerBase
|
||||
/**
|
||||
* search menu items
|
||||
* @return array
|
||||
* @throws Menu\MenuInitException when unable to construct menu
|
||||
*/
|
||||
public function searchAction()
|
||||
{
|
||||
|
||||
@ -108,7 +108,6 @@ class MenuSystem
|
||||
* Load and persist Menu configuration to disk.
|
||||
* @param bool $nowait when the cache is locked, skip waiting for it to become available.
|
||||
* @return SimpleXMLElement
|
||||
* @throws MenuInitException
|
||||
*/
|
||||
public function persist($nowait = true)
|
||||
{
|
||||
@ -133,9 +132,13 @@ class MenuSystem
|
||||
foreach (glob($vendor . '/*') as $module) {
|
||||
$menu_cfg_xml = $module . '/Menu/Menu.xml';
|
||||
if (file_exists($menu_cfg_xml)) {
|
||||
$domNode = dom_import_simplexml($this->addXML($menu_cfg_xml));
|
||||
$domNode = $root->ownerDocument->importNode($domNode, true);
|
||||
$root->appendChild($domNode);
|
||||
try {
|
||||
$domNode = dom_import_simplexml($this->addXML($menu_cfg_xml));
|
||||
$domNode = $root->ownerDocument->importNode($domNode, true);
|
||||
$root->appendChild($domNode);
|
||||
} catch (MenuInitException $e) {
|
||||
error_log($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user