aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/controller/install.php
diff options
context:
space:
mode:
authorMateBartus <mate.bartus@gmail.com>2015-04-28 22:33:04 +0200
committerMate Bartus <mate.bartus@gmail.com>2015-07-08 01:27:57 +0200
commit11623dd6718ec12504286db3dfcd042ccb4e3688 (patch)
treefe36007c205bd7bc4cb8563550fbf0d7dce9b4a8 /phpBB/install/controller/install.php
parent8155205ae7a5ec27ff3058137513fc480d7ee6c5 (diff)
downloadforums-11623dd6718ec12504286db3dfcd042ccb4e3688.tar
forums-11623dd6718ec12504286db3dfcd042ccb4e3688.tar.gz
forums-11623dd6718ec12504286db3dfcd042ccb4e3688.tar.bz2
forums-11623dd6718ec12504286db3dfcd042ccb4e3688.tar.xz
forums-11623dd6718ec12504286db3dfcd042ccb4e3688.zip
[ticket/13740] Front facing files and controllers
[ci skip] PHPBB3-13740
Diffstat (limited to 'phpBB/install/controller/install.php')
-rw-r--r--phpBB/install/controller/install.php109
1 files changed, 109 insertions, 0 deletions
diff --git a/phpBB/install/controller/install.php b/phpBB/install/controller/install.php
new file mode 100644
index 0000000000..1217107484
--- /dev/null
+++ b/phpBB/install/controller/install.php
@@ -0,0 +1,109 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\install\controller;
+
+use Symfony\Component\HttpFoundation\StreamedResponse;
+
+/**
+ * Controller for installing phpBB
+ */
+class install
+{
+ /**
+ * @var \phpbb\install\controller\helper
+ */
+ protected $controller_helper;
+
+ /**
+ * @var \phpbb\install\helper\iohandler\factory
+ */
+ protected $iohandler_factory;
+
+ /**
+ * @var \phpbb\template\template
+ */
+ protected $template;
+
+ /**
+ * @var \phpbb\request\request_interface
+ */
+ protected $request;
+
+ /**
+ * @var \phpbb\install\installer
+ */
+ protected $installer;
+
+ /**
+ * Constructor
+ *
+ * @param helper $helper
+ * @param \phpbb\install\helper\iohandler\factory $factory
+ * @param \phpbb\request\request_interface $request
+ * @param \phpbb\install\installer $installer
+ */
+ public function __construct(helper $helper, \phpbb\install\helper\iohandler\factory $factory, \phpbb\template\template $template, \phpbb\request\request_interface $request, \phpbb\install\installer $installer)
+ {
+ $this->controller_helper = $helper;
+ $this->iohandler_factory = $factory;
+ $this->template = $template;
+ $this->request = $request;
+ $this->installer = $installer;
+ }
+
+ public function handle()
+ {
+ // @todo check that phpBB is not 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');
+ }
+
+ if ($this->request->is_ajax())
+ {
+ $installer = &$this->installer;
+
+ $response = new StreamedResponse();
+ $response->setCallback(function() use ($installer) {
+ $installer->run();
+ });
+
+ return $response;
+ }
+ else
+ {
+ // Determine whether the installation was started or not
+ if (true)
+ {
+ // If not, let's render the welcome page
+ $this->template->assign_vars(array(
+ 'SHOW_INSTALL_START_FORM' => true,
+ ));
+ return $this->controller_helper->render('installer_install.html', 'INSTALL');
+ }
+
+ // @todo: implement no js controller logic
+ }
+ }
+}