Chris@0: connection = $connection; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Handles errors for this subscriber. Chris@0: * Chris@0: * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event Chris@0: * The event to process. Chris@0: */ Chris@0: public function onException(GetResponseForExceptionEvent $event) { Chris@0: $exception = $event->getException(); Chris@0: if ($this->shouldRedirectToInstaller($exception, $this->connection)) { Chris@0: // Only redirect if this is an HTML response (i.e., a user trying to view Chris@0: // the site in a web browser before installing it). Chris@0: $request = $event->getRequest(); Chris@0: $format = $request->query->get(MainContentViewSubscriber::WRAPPER_FORMAT, $request->getRequestFormat()); Chris@0: if ($format == 'html') { Chris@0: $event->setResponse(new RedirectResponse($request->getBasePath() . '/core/install.php', 302, ['Cache-Control' => 'no-cache'])); Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Registers the methods in this class that should be listeners. Chris@0: * Chris@0: * @return array Chris@0: * An array of event listener definitions. Chris@0: */ Chris@0: public static function getSubscribedEvents() { Chris@0: $events[KernelEvents::EXCEPTION][] = ['onException', 100]; Chris@0: return $events; Chris@0: } Chris@0: Chris@0: }