Exemple #1
0
 /**
  * Controller logic
  *
  * @return Response|StreamedResponse
  */
 public function handle()
 {
     if ($this->install_helper->is_phpbb_installed()) {
         die('phpBB is already installed');
     }
     $this->template->assign_vars(array('U_ACTION' => $this->controller_helper->route('phpbb_installer_install')));
     // Set up input-output handler
     if ($this->request->is_ajax()) {
         $this->iohandler_factory->set_environment('ajax');
     } else {
         $this->iohandler_factory->set_environment('nojs');
     }
     // Set the appropriate input-output handler
     $this->installer->set_iohandler($this->iohandler_factory->get());
     // Set up navigation
     $nav_data = $this->installer_config->get_navigation_data();
     /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
     $iohandler = $this->iohandler_factory->get();
     // Set active navigation stage
     if (isset($nav_data['active']) && is_array($nav_data['active'])) {
         $iohandler->set_active_stage_menu($nav_data['active']);
         $this->menu_provider->set_nav_property($nav_data['active'], array('selected' => true, 'completed' => false));
     }
     // Set finished navigation stages
     if (isset($nav_data['finished']) && is_array($nav_data['finished'])) {
         foreach ($nav_data['finished'] as $finished_stage) {
             $iohandler->set_finished_stage_menu($finished_stage);
             $this->menu_provider->set_nav_property($finished_stage, array('selected' => false, 'completed' => true));
         }
     }
     if ($this->request->is_ajax()) {
         $installer = $this->installer;
         $response = new StreamedResponse();
         $response->setCallback(function () use($installer) {
             $installer->run();
         });
         // Try to bypass any server output buffers
         $response->headers->set('X-Accel-Buffering', 'no');
         return $response;
     } else {
         // Determine whether the installation was started or not
         if (true) {
             $this->controller_helper->handle_language_select();
             // Set active stage
             $this->menu_provider->set_nav_property(array('install', 0, 'introduction'), array('selected' => true, 'completed' => false));
             // If not, let's render the welcome page
             $this->template->assign_vars(array('SHOW_INSTALL_START_FORM' => true, 'TITLE' => $this->language->lang('INSTALL_INTRO'), 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY')));
             return $this->controller_helper->render('installer_install.html', 'INSTALL', true);
         }
         // @todo: implement no js controller logic
     }
 }
Exemple #2
0
 /**
  * Process navigation data to reflect active/completed stages
  *
  * @param \phpbb\install\helper\iohandler\iohandler_interface|null	$iohandler
  */
 public function handle_navigation($iohandler = null)
 {
     $nav_data = $this->installer_config->get_navigation_data();
     // Set active navigation stage
     if (isset($nav_data['active']) && is_array($nav_data['active'])) {
         if ($iohandler !== null) {
             $iohandler->set_active_stage_menu($nav_data['active']);
         }
         $this->navigation_provider->set_nav_property($nav_data['active'], array('selected' => true, 'completed' => false));
     }
     // Set finished navigation stages
     if (isset($nav_data['finished']) && is_array($nav_data['finished'])) {
         foreach ($nav_data['finished'] as $finished_stage) {
             if ($iohandler !== null) {
                 $iohandler->set_finished_stage_menu($finished_stage);
             }
             $this->navigation_provider->set_nav_property($finished_stage, array('selected' => false, 'completed' => true));
         }
     }
 }