Exemplo n.º 1
0
 /**
  * Controller action for the final step
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function finalAction()
 {
     $session = $this->get('session');
     // We're going to assume a bit here; if the config file exists already and DB info is provided, assume the app is installed and redirect
     if ($this->checkIfInstalled()) {
         if (!$session->has('mautic.installer.completedsteps')) {
             // Arrived here by directly browsing to URL so redirect to the dashboard
             return $this->redirect($this->generateUrl('mautic_dashboard_index'));
         }
     } else {
         // Shouldn't have made it to this step without having a successful install
         return $this->redirect($this->generateUrl('mautic_installer_home'));
     }
     // Remove installer session variables
     $session->remove('mautic.installer.completedsteps');
     $session->remove('mautic.installer.user');
     // Add database migrations up to this point since this is a fresh install (must be done at this point
     // after the cache has been rebuilt
     $input = new ArgvInput(['console', 'doctrine:migrations:version', '--add', '--all', '--no-interaction']);
     $output = new BufferedOutput();
     $application = new Application($this->container->get('kernel'));
     $application->setAutoExit(false);
     $application->run($input, $output);
     $welcomeUrl = $this->generateUrl('mautic_dashboard_index');
     $tmpl = $this->request->isXmlHttpRequest() ? $this->request->get('tmpl', 'index') : 'index';
     return $this->delegateView(['viewParameters' => ['welcome_url' => $welcomeUrl, 'parameters' => $this->configurator->render(), 'config_path' => $this->get('mautic.helper.paths')->getSystemPath('local_config'), 'is_writable' => $this->configurator->isFileWritable(), 'version' => MAUTIC_VERSION, 'tmpl' => $tmpl], 'contentTemplate' => 'MauticInstallBundle:Install:final.html.php', 'passthroughVars' => ['activeLink' => '#mautic_installer_index', 'mauticContent' => 'installer', 'route' => $this->generateUrl('mautic_installer_final')]]);
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param Configurator $configurator Configurator service
  * @param string       $kernelRoot   Kernel root path
  * @param RequestStack $requestStack Request stack
  */
 public function __construct(Configurator $configurator, $kernelRoot, RequestStack $requestStack)
 {
     $request = $requestStack->getCurrentRequest();
     $this->configIsWritable = $configurator->isFileWritable();
     $this->kernelRoot = $kernelRoot;
     $this->site_url = $request->getSchemeAndHttpHost() . $request->getBasePath();
 }