Do not use Installer anywhere.

"It's setup."

refs #7163
This commit is contained in:
Johannes Meyer 2014-11-10 10:30:52 +01:00
parent 6c664b72aa
commit 79493592bb
25 changed files with 85 additions and 83 deletions

View File

@ -18,7 +18,7 @@ class SetupCommand extends Command
/**
* Display the current setup token
*
* Shows you the current setup token used to authenticate when installing Icinga Web 2 using the web-based wizard
* Shows you the current setup token used to authenticate when setting up Icinga Web 2 using the web-based wizard
*
* USAGE:
*
@ -39,7 +39,7 @@ class SetupCommand extends Command
/**
* Create a new setup token
*
* Re-generates the setup token used to authenticate when installing Icinga Web 2 using the web-based wizard.
* Re-generates the setup token used to authenticate when setting up Icinga Web 2 using the web-based wizard.
*
* USAGE:
*

View File

@ -107,7 +107,7 @@ class AuthenticationController extends ActionController
throw new ConfigurationError(
$this->translate(
'No authentication methods available. Did you create'
. ' authentication.ini when installing Icinga Web 2?'
. ' authentication.ini when setting up Icinga Web 2?'
)
);
}

View File

@ -2,7 +2,7 @@
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Application\WebSetup;
use Icinga\Application\WebWizard;
use Icinga\Web\Controller\ActionController;
class SetupController extends ActionController
@ -17,15 +17,15 @@ class SetupController extends ActionController
protected $requiresAuthentication = false;
/**
* Show the web wizard and run the installation once finished
* Show the web wizard and run the configuration once finished
*/
public function indexAction()
{
$wizard = new WebSetup();
$wizard = new WebWizard();
if ($wizard->isFinished()) {
$installer = $wizard->getInstaller();
$success = $installer->run();
$setup = $wizard->getSetup();
$success = $setup->run();
if ($success) {
$wizard->clearSession();
} else {
@ -33,7 +33,7 @@ class SetupController extends ActionController
}
$this->view->success = $success;
$this->view->report = $installer->getReport();
$this->view->report = $setup->getReport();
} else {
$wizard->handleRequest();
}

View File

@ -41,8 +41,8 @@ class DbResourcePage extends Form
'description',
array(
'value' => t(
'Now please configure your database resource. Note that the database itself does not need'
. ' to exist at this time as it is going to be created when installing Icinga Web 2.'
'Now please configure your database resource. Note that the database itself does not need to'
. ' exist at this time as it is going to be created once the wizard is about to be finished.'
)
)
)

View File

@ -8,7 +8,7 @@ use Icinga\Web\Form;
use Icinga\Web\Setup\Requirements;
/**
* Wizard page to list installation requirements
* Wizard page to list setup requirements
*/
class RequirementsPage extends Form
{

View File

@ -12,7 +12,7 @@ use Icinga\Web\Form;
class SummaryPage extends Form
{
/**
* The title of what is being installed
* The title of what is being set up
*
* @var string
*/
@ -35,7 +35,7 @@ class SummaryPage extends Form
}
/**
* Set the title of what is being installed
* Set the title of what is being set up
*
* @param string $title
*/
@ -45,7 +45,7 @@ class SummaryPage extends Form
}
/**
* Return the title of what is being installed
* Return the title of what is being set up
*
* @return string
*/

View File

@ -20,10 +20,10 @@
t(
'You seem not to have Icinga Web 2 configured yet so it\'s not possible to log in without any defined '
. 'authentication method. Please define a authentication method by following the instructions in the'
. ' %1$sdocumentation%3$s or by using our %2$sweb-based installer%3$s.'
. ' %1$sdocumentation%3$s or by using our %2$sweb-based setup-wizard%3$s.'
),
'<a href="' . 'documention-link-here' . '" title="Icinga Web 2 Documentation">', // TODO: Documentation link
'<a href="' . $this->href('setup') . '" title="Icinga Web 2 Installer">',
'<a href="' . $this->href('setup') . '" title="Icinga Web 2 Setup-Wizard">',
'</a>'
); ?></div>
<?php endif ?>

View File

@ -4,7 +4,7 @@ use Icinga\Web\Wizard;
?>
<div class="module-menu">
<p><?= t('The following modules are available for installation using a web-based wizard as well. To install a module, just complete its wizard and advance to the summary!'); ?></p>
<p><?= t('The following modules can be set up by using a web-based wizard as well. To setup a module, just complete its wizard and advance to the summary!'); ?></p>
<p><?= t('You can freely switch to a module\'s wizard by clicking its name below. The wizard you are currently looking at is written in bold. A small tick is shown on the right once a wizard has been completed.'); ?></p>
<form name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>" action="<?= $form->getAction(); ?>">
<?= $form->getElement($form->getTokenElementName()); ?>

View File

@ -5,9 +5,9 @@ use Icinga\Web\Wizard;
?>
<p><?= sprintf(
t(
'The wizard is now complete. You can review the changes supposed to be made before issuing the actual installation'
. ' of %1$s. Make sure that everything is correct (Feel free to navigate back to make any corrections!) so'
. ' that you can start using %1$s right after the installation has been finished.'
'The wizard is now complete. You can review the changes supposed to be made before setting up %1$s.'
. ' Make sure that everything is correct (Feel free to navigate back to make any corrections!) so'
. ' that you can start using %1$s right after it has successfully been set up.'
),
$form->getSubjectTitle()
); ?></p>
@ -25,6 +25,6 @@ use Icinga\Web\Wizard;
<?= $form->getElement($form->getUidElementName()); ?>
<div class="buttons">
<?= $form->getElement(Wizard::BTN_PREV); ?>
<?= $form->getElement(Wizard::BTN_NEXT)->setAttrib('class', 'install'); ?>
<?= $form->getElement(Wizard::BTN_NEXT)->setAttrib('class', 'finish'); ?>
</div>
</form>

View File

@ -9,7 +9,7 @@ $setupTokenPath = rtrim(Icinga::app()->getConfigDir(), '/') . '/setup.token';
?>
<div class="welcome-page">
<h2><?= t('Welcome to the installation of Icinga Web 2!') ?></h2>
<h2><?= t('Welcome to the configuration of Icinga Web 2!') ?></h2>
<!-- TODO: Remove this once we release the first public version -->
<div style="border:1px solid #777;border-radius:1em;background-color:beige;padding:1em;margin-bottom:1em;display:inline-block;">
Icinga Web 2 is still in development and not meant for production deployment.
@ -36,12 +36,12 @@ $setupTokenPath = rtrim(Icinga::app()->getConfigDir(), '/') . '/setup.token';
</div>
<?php if (false === file_exists($setupTokenPath) && file_exists(Config::resolvePath('config.ini'))): ?>
<p class="restart-warning"><?= t(
'You\'ve already completed the installation of Icinga Web 2. Note that most of your configuration'
'You\'ve already completed the configuration of Icinga Web 2. Note that most of your configuration'
. ' files will be overwritten in case you\'ll re-configure Icinga Web 2 using this wizard!'
); ?></p>
<?php else: ?>
<p><?= t(
'This wizard will guide you through the installation of Icinga Web 2. Once completed and successfully'
'This wizard will guide you through the configuration of Icinga Web 2. Once completed and successfully'
. ' finished you are able to log in and to explore all the new and stunning features!'
); ?></p>
<?php endif ?>

View File

@ -125,7 +125,7 @@ if ($notifications->hasMessages()) {
</tr></tbody></table>
</div>
<div class="step" style="width: 10%;">
<h1><?= t('Installation', 'setup.progress'); ?></h1>
<h1><?= t('Finish', 'setup.progress'); ?></h1>
<?php $stateClass = $finished ? ' active' : ''; ?>
<table><tbody><tr>
<td class="left"><div class="line left<?= $stateClass; ?>"></div></td>
@ -137,7 +137,7 @@ if ($notifications->hasMessages()) {
</div>
<div class="setup-content">
<?php if ($finished): ?>
<?= $this->render('setup/parts/install.phtml'); ?>
<?= $this->render('setup/parts/finish.phtml'); ?>
<?php else: ?>
<?= $this->render('setup/parts/wizard.phtml'); ?>
<?php endif ?>

View File

@ -1,4 +1,4 @@
<div id="installer">
<div id="setup-finish">
<div class="report">
<?php $firstLine = true; ?>
<?php foreach ($report as $entry): ?>
@ -11,9 +11,9 @@
<?php endif ?>
<?php endforeach ?>
<?php if ($success): ?>
<p class="success"><?= t('Congratulations! The installation of Icinga Web 2 has been successfully completed.'); ?></p>
<p class="success"><?= t('Congratulations! Icinga Web 2 has been successfully set up.'); ?></p>
<?php else: ?>
<p class="failure"><?= t('Sorry! The installation of Icinga Web 2 has failed.'); ?></p>
<p class="failure"><?= t('Sorry! Failed to set up Icinga Web 2 successfully.'); ?></p>
<?php endif ?>
</div>
<div class="buttons">

View File

@ -26,8 +26,8 @@ use Icinga\Installation\AuthenticationStep;
use Icinga\Web\Form;
use Icinga\Web\Wizard;
use Icinga\Web\Request;
use Icinga\Web\Setup\Setup;
use Icinga\Web\Setup\DbTool;
use Icinga\Web\Setup\Installer;
use Icinga\Web\Setup\MakeDirStep;
use Icinga\Web\Setup\SetupWizard;
use Icinga\Web\Setup\Requirements;
@ -35,7 +35,7 @@ use Icinga\Web\Setup\Requirements;
/**
* Icinga Web 2 Setup Wizard
*/
class WebSetup extends Wizard implements SetupWizard
class WebWizard extends Wizard implements SetupWizard
{
/**
* The privileges required by Icinga Web 2 to setup the database
@ -138,7 +138,7 @@ class WebSetup extends Wizard implements SetupWizard
$page->setResourceConfig($this->getPageData('setup_db_resource'));
} elseif ($page->getName() === 'setup_summary') {
$page->setSubjectTitle('Icinga Web 2');
$page->setSummary($this->getInstaller()->getSummary());
$page->setSummary($this->getSetup()->getSummary());
} elseif ($page->getName() === 'setup_db_resource') {
$ldapData = $this->getPageData('setup_ldap_resource');
if ($ldapData !== null && $request->getPost('name') === $ldapData['name']) {
@ -251,7 +251,7 @@ class WebSetup extends Wizard implements SetupWizard
if ($index === 0) {
$page->getElement(static::BTN_NEXT)->setLabel(t('Start', 'setup.welcome.btn.next'));
} elseif ($index === count($pages) - 1) {
$page->getElement(static::BTN_NEXT)->setLabel(t('Install Icinga Web 2', 'setup.summary.btn.finish'));
$page->getElement(static::BTN_NEXT)->setLabel(t('Setup Icinga Web 2', 'setup.summary.btn.finish'));
}
}
@ -270,12 +270,12 @@ class WebSetup extends Wizard implements SetupWizard
}
/**
* @see SetupWizard::getInstaller()
* @see SetupWizard::getSetup()
*/
public function getInstaller()
public function getSetup()
{
$pageData = $this->getPageData();
$installer = new Installer();
$setup = new Setup();
if (isset($pageData['setup_db_resource'])
&& ! $pageData['setup_db_resource']['skip_validation']
@ -283,7 +283,7 @@ class WebSetup extends Wizard implements SetupWizard
|| ! $pageData['setup_database_creation']['skip_validation']
)
) {
$installer->addStep(
$setup->addStep(
new DatabaseStep(array(
'tables' => $this->databaseTables,
'privileges' => $this->databaseUsagePrivileges,
@ -298,7 +298,7 @@ class WebSetup extends Wizard implements SetupWizard
);
}
$installer->addStep(
$setup->addStep(
new GeneralConfigStep(array(
'generalConfig' => $pageData['setup_general_config'],
'preferencesType' => $pageData['setup_preferences_type']['type'],
@ -320,7 +320,7 @@ class WebSetup extends Wizard implements SetupWizard
$adminAccountData['password'] = $pageData['setup_admin_account']['new_user_password'];
}
$authType = $pageData['setup_authentication_type']['type'];
$installer->addStep(
$setup->addStep(
new AuthenticationStep(array(
'adminAccountData' => $adminAccountData,
'fileMode' => $pageData['setup_general_config']['global_filemode'],
@ -332,7 +332,7 @@ class WebSetup extends Wizard implements SetupWizard
);
if (isset($pageData['setup_db_resource']) || isset($pageData['setup_ldap_resource'])) {
$installer->addStep(
$setup->addStep(
new ResourceStep(array(
'fileMode' => $pageData['setup_general_config']['global_filemode'],
'dbResourceConfig' => isset($pageData['setup_db_resource'])
@ -346,7 +346,7 @@ class WebSetup extends Wizard implements SetupWizard
}
$configDir = $this->getConfigDir();
$installer->addStep(
$setup->addStep(
new MakeDirStep(
array(
$configDir . '/modules',
@ -359,11 +359,11 @@ class WebSetup extends Wizard implements SetupWizard
foreach ($this->getPage('setup_modules')->setPageData($this->getPageData())->getWizards() as $wizard) {
if ($wizard->isFinished()) {
$installer->addSteps($wizard->getInstaller()->getSteps());
$setup->addSteps($wizard->getSetup()->getSteps());
}
}
return $installer;
return $setup;
}
/**

View File

@ -5,10 +5,10 @@
namespace Icinga\Exception;
/**
* Class InstallException
* Class SetupException
*
* Used to indicate that a installation should be aborted.
* Used to indicate that a setup should be aborted.
*/
class InstallException extends IcingaException
class SetupException extends IcingaException
{
}

View File

@ -9,7 +9,7 @@ use PDOException;
use Icinga\Web\Setup\Step;
use Icinga\Web\Setup\DbTool;
use Icinga\Application\Icinga;
use Icinga\Exception\InstallException;
use Icinga\Exception\SetupException;
class DatabaseStep extends Step
{
@ -45,7 +45,7 @@ class DatabaseStep extends Step
}
} catch (Exception $e) {
$this->error = $e;
throw new InstallException();
throw new SetupException();
}
$this->error = false;

View File

@ -13,7 +13,7 @@ use Icinga\Util\File;
use Icinga\Exception\ConfigurationError;
/**
* Utility class to ease working with databases when installing Icinga Web 2 or one of its modules
* Utility class to ease working with databases when setting up Icinga Web 2 or one of its modules
*/
class DbTool
{

View File

@ -45,8 +45,8 @@ class MakeDirStep extends Step
public function getSummary()
{
// This step is usually being used for directories which are required for the installation but are
// not configured in any way by the user. So there is no need to show a summary for this step.
// This step is usually being used for directories which are required for the configuration but
// are not defined in any way by the user. So there is no need to show a summary for this step.
}
public function getReport()

View File

@ -6,12 +6,12 @@ namespace Icinga\Web\Setup;
use ArrayIterator;
use IteratorAggregate;
use Icinga\Exception\InstallException;
use Icinga\Exception\SetupException;
/**
* Container for multiple installation steps
* Container for multiple configuration steps
*/
class Installer implements IteratorAggregate
class Setup implements IteratorAggregate
{
protected $steps;
@ -45,7 +45,7 @@ class Installer implements IteratorAggregate
}
/**
* Run the installation and return whether it succeeded
* Run the configuration and return whether it succeeded
*
* @return bool
*/
@ -57,7 +57,7 @@ class Installer implements IteratorAggregate
foreach ($this->steps as $step) {
$this->state &= $step->apply();
}
} catch (InstallException $e) {
} catch (SetupException $_) {
$this->state = false;
}

View File

@ -5,16 +5,16 @@
namespace Icinga\Web\Setup;
/**
* Interface for setup wizards providing an installer and requirements
* Interface for wizards providing a setup and requirements
*/
interface SetupWizard
{
/**
* Return the installer for this wizard
* Return the setup for this wizard
*
* @return Installer
* @return Setup
*/
public function getInstaller();
public function getSetup();
/**
* Return the requirements of this wizard

View File

@ -5,26 +5,26 @@
namespace Icinga\Web\Setup;
/**
* Class to implement functionality for a single installation step
* Class to implement functionality for a single setup step
*/
abstract class Step
{
/**
* Apply this step's installation changes
* Apply this step's configuration changes
*
* @return bool
*/
abstract public function apply();
/**
* Return a HTML representation of this step's installation changes supposed to be made
* Return a HTML representation of this step's configuration changes supposed to be made
*
* @return string
*/
abstract public function getSummary();
/**
* Return a HTML representation of this step's installation changes that were made
* Return a HTML representation of this step's configuration changes that were made
*
* @return string
*/

View File

@ -20,7 +20,10 @@ class WelcomePage extends Form
new Note(
'welcome',
array(
'value' => mt('monitoring', 'Welcome to the installation of the monitoring module for Icinga Web 2!'),
'value' => mt(
'monitoring',
'Welcome to the configuration of the monitoring module for Icinga Web 2!'
),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))

View File

@ -18,7 +18,7 @@ $this->provideConfigTab('security', array(
'title' => 'Security',
'url' => 'config/security'
));
$this->provideSetupWizard('Icinga\Module\Monitoring\Setup');
$this->provideSetupWizard('Icinga\Module\Monitoring\MonitoringWizard');
/*
* Available Search Urls

View File

@ -7,7 +7,7 @@ namespace Icinga\Module\Monitoring;
use Icinga\Web\Form;
use Icinga\Web\Wizard;
use Icinga\Web\Request;
use Icinga\Web\Setup\Installer;
use Icinga\Web\Setup\Setup;
use Icinga\Web\Setup\MakeDirStep;
use Icinga\Web\Setup\EnableModuleStep;
use Icinga\Web\Setup\SetupWizard;
@ -26,7 +26,7 @@ use Icinga\Module\Monitoring\Form\Setup\LivestatusResourcePage;
/**
* Monitoring Module Setup Wizard
*/
class Setup extends Wizard implements SetupWizard
class MonitoringWizard extends Wizard implements SetupWizard
{
/**
* @see Wizard::init()
@ -50,7 +50,7 @@ class Setup extends Wizard implements SetupWizard
if ($page->getName() === 'setup_requirements') {
$page->setRequirements($this->getRequirements());
} elseif ($page->getName() === 'setup_summary') {
$page->setSummary($this->getInstaller()->getSummary());
$page->setSummary($this->getSetup()->getSummary());
$page->setSubjectTitle(mt('monitoring', 'the monitoring module', 'setup.summary.subject'));
} elseif (
$this->getDirection() === static::FORWARD
@ -114,27 +114,27 @@ class Setup extends Wizard implements SetupWizard
$page->getElement(static::BTN_NEXT)->setLabel(t('Start', 'setup.welcome.btn.next'));
} elseif ($index === count($pages) - 1) {
$page->getElement(static::BTN_NEXT)->setLabel(
mt('monitoring', 'Install the monitoring module for Icinga Web 2', 'setup.summary.btn.finish')
mt('monitoring', 'Setup the monitoring module for Icinga Web 2', 'setup.summary.btn.finish')
);
}
}
/**
* @see SetupWizard::getInstaller()
* @see SetupWizard::getSetup()
*/
public function getInstaller()
public function getSetup()
{
$pageData = $this->getPageData();
$installer = new Installer();
$setup = new Setup();
$installer->addStep(
$setup->addStep(
new MakeDirStep(
array($this->getConfigDir() . '/modules/monitoring'),
$pageData['setup_general_config']['global_filemode']
)
);
$installer->addStep(
$setup->addStep(
new BackendStep(array(
'backendConfig' => $pageData['setup_monitoring_backend'],
'resourceConfig' => isset($pageData['setup_monitoring_ido'])
@ -144,23 +144,23 @@ class Setup extends Wizard implements SetupWizard
))
);
$installer->addStep(
$setup->addStep(
new InstanceStep(array(
'instanceConfig' => $pageData['setup_monitoring_instance'],
'fileMode' => $pageData['setup_general_config']['global_filemode']
))
);
$installer->addStep(
$setup->addStep(
new SecurityStep(array(
'securityConfig' => $pageData['setup_monitoring_security'],
'fileMode' => $pageData['setup_general_config']['global_filemode']
))
);
$installer->addStep(new EnableModuleStep('monitoring'));
$setup->addStep(new EnableModuleStep('monitoring'));
return $installer;
return $setup;
}
/**

View File

@ -36,7 +36,6 @@
<file>../../application/forms/Config/LoggingForm.php</file>
<file>../../application/forms/Config/ConfirmRemovalForm.php</file>
<directory suffix=".php">../../application/forms/Authentication</directory>
<directory suffix=".php">../../application/forms/Install</directory>
<directory suffix=".php">../../application/forms/Dashboard</directory>
<directory suffix=".php">../../application/forms/Preference</directory>
<!-- application/views -->

View File

@ -131,7 +131,7 @@
}
}
&.install, &.login {
&.finish, &.login {
width: 25em;
color: #fffafa;
background: #aaa;
@ -250,7 +250,7 @@
border-radius: 1em;
}
#installer {
#setup-finish {
div.report {
padding: 1em;
border-radius: 2em;