Skip to content

Commit

Permalink
Merge pull request #2508 from zikula/exception-listener-fix
Browse files Browse the repository at this point in the history
disable 'advanced' handling of RouteNotFoundException
  • Loading branch information
craigh committed Jun 23, 2015
2 parents f9dbdc6 + 8ba9416 commit 116cb9e
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,24 @@ private function handleRouteNotFoundException(GetResponseForExceptionEvent $even
$event->getRequest()->getSession()->getFlashBag()->add('error', $message);
if ($userLoggedIn && \SecurityUtil::checkPermission('ZikulaRoutesModule::', '::', ACCESS_ADMIN)) {
$originalRouteCollection = $this->router->getOriginalRouteCollection()->all();
if (!array_key_exists('zikularoutesmodule_route_reload', $originalRouteCollection)) {
// reload routes for the Routes module first
$this->routesControllerUtil->reloadRoutesByModule('ZikulaRoutesModule');
$this->cacheClearer->clear("symfony.routing");
if (array_key_exists('zikularoutesmodule_route_reload', $originalRouteCollection)) {
$url = $this->router->generate('zikularoutesmodule_route_reload', array('lct' => 'admin'), RouterInterface::ABSOLUTE_URL);
$link = "<a href='$url'>". __('re-loading the routes') . "</a>";
$event->getRequest()->getSession()->getFlashBag()->add('error', __f('You might try %s for the extension in question.', $link));
}
$url = $this->router->generate('zikularoutesmodule_route_reload', array('lct' => 'admin'), RouterInterface::ABSOLUTE_URL);
$frontController = \System::getVar('entrypoint', 'index.php');
if (strpos($url, "$frontController/") !== false) {
$url = str_ireplace("$frontController/", "", $url);
}
$event->getRequest()->getSession()->getFlashBag()->add('error', __('You might try re-loading the routes for the extension in question.'));
$event->setResponse(new RedirectResponse($url));
$event->stopPropagation();
// if (!array_key_exists('zikularoutesmodule_route_reload', $originalRouteCollection)) {
// // reload routes for the Routes module first
// $this->routesControllerUtil->reloadRoutesByModule('ZikulaRoutesModule');
// $this->cacheClearer->clear("symfony.routing");
// }
// $url = $this->router->generate('zikularoutesmodule_route_reload', array('lct' => 'admin'), RouterInterface::ABSOLUTE_URL);
// $frontController = \System::getVar('entrypoint', 'index.php');
// if (strpos($url, "$frontController/") !== false) {
// $url = str_ireplace("$frontController/", "", $url);
// }
// $event->getRequest()->getSession()->getFlashBag()->add('error', __('You might try re-loading the routes for the extension in question.'));
// $event->setResponse(new RedirectResponse($url));
// $event->stopPropagation();
}
}

Expand Down

0 comments on commit 116cb9e

Please sign in to comment.