2014-09-10 14:48:33 +02:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2014-09-10 14:48:33 +02:00
|
|
|
|
2015-08-27 14:21:29 +02:00
|
|
|
namespace Icinga\Module\Setup\Controllers;
|
|
|
|
|
2014-11-10 16:31:40 +01:00
|
|
|
use Icinga\Module\Setup\WebWizard;
|
2015-08-27 14:20:53 +02:00
|
|
|
use Icinga\Web\Controller;
|
2014-09-10 14:48:33 +02:00
|
|
|
|
2015-08-27 14:21:29 +02:00
|
|
|
class IndexController extends Controller
|
2014-09-10 14:48:33 +02: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 14:56:25 +02:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
protected $innerLayout = 'inline';
|
|
|
|
|
2014-09-10 14:48:33 +02:00
|
|
|
/**
|
2014-11-10 10:30:52 +01:00
|
|
|
* Show the web wizard and run the configuration once finished
|
2014-09-10 14:48:33 +02:00
|
|
|
*/
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2014-11-10 10:30:52 +01:00
|
|
|
$wizard = new WebWizard();
|
2014-09-29 14:31:43 +02:00
|
|
|
|
|
|
|
if ($wizard->isFinished()) {
|
2014-11-10 10:30:52 +01:00
|
|
|
$setup = $wizard->getSetup();
|
|
|
|
$success = $setup->run();
|
2014-09-29 14:31:43 +02:00
|
|
|
if ($success) {
|
2014-10-24 13:55:41 +02:00
|
|
|
$wizard->clearSession();
|
2014-09-29 14:31:43 +02:00
|
|
|
} else {
|
|
|
|
$wizard->setIsFinished(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view->success = $success;
|
2014-11-10 10:30:52 +01:00
|
|
|
$this->view->report = $setup->getReport();
|
2014-09-29 14:31:43 +02:00
|
|
|
} else {
|
|
|
|
$wizard->handleRequest();
|
|
|
|
}
|
2014-10-14 16:14:28 +02:00
|
|
|
|
|
|
|
$this->view->wizard = $wizard;
|
2014-09-10 14:48:33 +02:00
|
|
|
}
|
|
|
|
}
|