Example #1
0
 /**
  * {@inheritdoc}
  */
 public function get()
 {
     if (!$this->install_helper->is_phpbb_installed()) {
         return array();
     }
     return array('update' => array('label' => 'UPDATE', 'route' => 'phpbb_installer_update', 'order' => 1, array('introduction' => array('label' => 'INTRODUCTION_TITLE', 'stage' => true, 'order' => 0), 'requirements' => array('label' => 'STAGE_REQUIREMENTS', 'stage' => true, 'order' => 1), 'obtain_data' => array('label' => 'STAGE_OBTAIN_DATA', 'stage' => true, 'order' => 2), 'update_files' => array('label' => 'STAGE_UPDATE_FILES', 'stage' => true, 'order' => 3), 'update_database' => array('label' => 'STAGE_UPDATE_DATABASE', 'stage' => true, 'order' => 4))));
 }
 /**
  * {@inheritdoc}
  */
 public function get()
 {
     if (!$this->install_helper->is_phpbb_installed()) {
         return array();
     }
     return array('convert' => array('label' => 'CONVERT', 'route' => 'phpbb_convert_intro', 'order' => 3, array('intro' => array('label' => 'SUB_INTRO', 'stage' => true, 'order' => 0), 'settings' => array('label' => 'STAGE_SETTINGS', 'stage' => true, 'route' => 'phpbb_convert_settings', 'order' => 1), 'convert' => array('label' => 'STAGE_IN_PROGRESS', 'stage' => true, 'route' => 'phpbb_convert_convert', 'order' => 2), 'finish' => array('label' => 'CONVERT_COMPLETE', 'stage' => true, 'route' => 'phpbb_convert_finish', 'order' => 3))));
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function get()
 {
     if ($this->install_helper->is_phpbb_installed()) {
         return array();
     }
     return array('install' => array('label' => 'INSTALL', 'route' => 'phpbb_installer_install', 'order' => 1, array('introduction' => array('label' => 'INTRODUCTION_TITLE', 'stage' => true, 'order' => 0), 'requirements' => array('label' => 'STAGE_REQUIREMENTS', 'stage' => true, 'order' => 1), 'obtain_data' => array('label' => 'STAGE_OBTAIN_DATA', 'stage' => true, 'order' => 2), 'install' => array('label' => 'STAGE_INSTALL', 'stage' => true, 'order' => 3))));
 }
Example #4
0
 /**
  * Constructor
  *
  * @param driver_interface		$cache
  * @param container_factory		$container
  * @param database				$db_helper
  * @param helper				$controller_helper
  * @param install_helper		$install_helper
  * @param factory				$iohandler
  * @param language				$language
  * @param navigation_provider	$nav
  * @param request_interface		$request
  * @param template				$template
  * @param string				$phpbb_root_path
  * @param string				$php_ext
  */
 public function __construct(driver_interface $cache, container_factory $container, database $db_helper, helper $controller_helper, install_helper $install_helper, factory $iohandler, language $language, navigation_provider $nav, request_interface $request, template $template, $phpbb_root_path, $php_ext)
 {
     $this->installer_cache = $cache;
     $this->controller_helper = $controller_helper;
     $this->db_helper = $db_helper;
     $this->install_helper = $install_helper;
     $this->language = $language;
     $this->navigation_provider = $nav;
     $this->request = $request;
     $this->template = $template;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $php_ext;
     $iohandler->set_environment('ajax');
     $this->iohandler = $iohandler->get();
     if (!$this->install_helper->is_phpbb_installed() || !defined('IN_INSTALL')) {
         throw new http_exception(403, 'INSTALL_PHPBB_NOT_INSTALLED');
     }
     $this->controller_helper->handle_language_select();
     $this->cache = $container->get('cache.driver');
     $this->config = $container->get('config');
     $this->config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext);
     $this->db = $container->get('dbal.conn.driver');
     $this->config_table = $container->get_parameter('tables.config');
     $this->session_keys_table = $container->get_parameter('tables.sessions_keys');
     $this->session_table = $container->get_parameter('tables.sessions');
 }
Example #5
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
     }
 }
Example #6
0
 /**
  * Executes the command update.
  *
  * Update the board
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->iohandler_factory->set_environment('cli');
     /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */
     $iohandler = $this->iohandler_factory->get();
     $style = new SymfonyStyle($input, $output);
     $iohandler->set_style($style, $output);
     $this->installer->set_iohandler($iohandler);
     $config_file = $input->getArgument('config-file');
     if (!$this->install_helper->is_phpbb_installed()) {
         $iohandler->add_error_message('INSTALL_PHPBB_NOT_INSTALLED');
         return 1;
     }
     if (!is_file($config_file)) {
         $iohandler->add_error_message(array('MISSING_FILE', $config_file));
         return 1;
     }
     try {
         $config = Yaml::parse(file_get_contents($config_file), true, false);
     } catch (ParseException $e) {
         $iohandler->add_error_message(array('INVALID_YAML_FILE', $config_file));
         return 1;
     }
     $processor = new Processor();
     $configuration = new updater_configuration();
     try {
         $config = $processor->processConfiguration($configuration, $config);
     } catch (Exception $e) {
         $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage());
         return 1;
     }
     $this->register_configuration($iohandler, $config);
     try {
         $this->installer->run();
         return 0;
     } catch (installer_exception $e) {
         $iohandler->add_error_message($e->getMessage());
         return 1;
     }
 }
Example #7
0
 /**
  * Controller entry point
  *
  * @return Response|StreamedResponse
  *
  * @throws http_exception When phpBB is not installed
  */
 public function handle()
 {
     if (!$this->install_helper->is_phpbb_installed()) {
         throw new http_exception(403, 'INSTALL_PHPBB_NOT_INSTALLED');
     }
     $this->template->assign_vars(array('U_ACTION' => $this->controller_helper->route('phpbb_installer_update')));
     // 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());
     $this->controller_helper->handle_language_select();
     // Render the intro page
     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');
         $response->headers->set('Content-type', 'application/json');
         return $response;
     } else {
         // Set active stage
         $this->menu_provider->set_nav_property(array('update', 0, 'introduction'), array('selected' => true, 'completed' => false));
         $this->template->assign_vars(array('SHOW_INSTALL_START_FORM' => true, 'TITLE' => $this->language->lang('UPDATE_INSTALLATION'), 'CONTENT' => $this->language->lang('UPDATE_INSTALLATION_EXPLAIN')));
         /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
         $iohandler = $this->iohandler_factory->get();
         $this->controller_helper->handle_navigation($iohandler);
         return $this->controller_helper->render('installer_update.html', 'UPDATE_INSTALLATION', true);
     }
 }