2014-09-10 08:48:33 -04:00
|
|
|
<?php
|
2016-02-08 09:41:00 -05:00
|
|
|
/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
2014-09-10 08:48:33 -04:00
|
|
|
|
2015-08-27 08:21:29 -04:00
|
|
|
namespace Icinga\Module\Setup\Controllers;
|
|
|
|
|
|
2014-11-10 10:31:40 -05:00
|
|
|
use Icinga\Module\Setup\WebWizard;
|
2015-08-27 08:20:53 -04:00
|
|
|
use Icinga\Web\Controller;
|
2014-09-10 08:48:33 -04:00
|
|
|
|
2015-08-27 08:21:29 -04:00
|
|
|
class IndexController extends Controller
|
2014-09-10 08:48:33 -04:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Whether the controller requires the user to be authenticated
|
|
|
|
|
*
|
|
|
|
|
* FALSE as the wizard uses token authentication
|
|
|
|
|
*
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
protected $requiresAuthentication = false;
|
|
|
|
|
|
2015-08-18 08:56:25 -04:00
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
protected $innerLayout = 'inline';
|
|
|
|
|
|
2014-09-10 08:48:33 -04:00
|
|
|
/**
|
2014-11-10 04:30:52 -05:00
|
|
|
* Show the web wizard and run the configuration once finished
|
2014-09-10 08:48:33 -04:00
|
|
|
*/
|
|
|
|
|
public function indexAction()
|
|
|
|
|
{
|
2014-11-10 04:30:52 -05:00
|
|
|
$wizard = new WebWizard();
|
2014-09-29 08:31:43 -04:00
|
|
|
|
|
|
|
|
if ($wizard->isFinished()) {
|
2014-11-10 04:30:52 -05:00
|
|
|
$setup = $wizard->getSetup();
|
|
|
|
|
$success = $setup->run();
|
2014-09-29 08:31:43 -04:00
|
|
|
if ($success) {
|
2014-10-24 07:55:41 -04:00
|
|
|
$wizard->clearSession();
|
2014-09-29 08:31:43 -04:00
|
|
|
} else {
|
|
|
|
|
$wizard->setIsFinished(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->view->success = $success;
|
2014-11-10 04:30:52 -05:00
|
|
|
$this->view->report = $setup->getReport();
|
2014-09-29 08:31:43 -04:00
|
|
|
} else {
|
|
|
|
|
$wizard->handleRequest();
|
|
|
|
|
}
|
2014-10-14 10:14:28 -04:00
|
|
|
|
|
|
|
|
$this->view->wizard = $wizard;
|
2014-09-10 08:48:33 -04:00
|
|
|
}
|
|
|
|
|
}
|