Skip to content

Commit

Permalink
Add log directory as requirement and refactor some descriptions
Browse files Browse the repository at this point in the history
refs #3761
  • Loading branch information
Johannes Meyer committed Oct 10, 2013
1 parent 73e10c9 commit 4a2a7ae
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 41 deletions.
22 changes: 16 additions & 6 deletions install/application/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ private function init()
$status = $this->getStatusCode('configCheck/');
$this->validApacheConfig = $status === null ? null : $status === 403;

$logDir = Wizard::getInstance()->getLoggingDir();
$configDir = Wizard::getInstance()->getConfigurationDir();
$this->pathAccess = array(
'config' => is_readable($configDir) && is_writable($configDir)
'config' => is_readable($configDir) && is_writable($configDir),
'log' => is_readable($logDir) && is_writable($logDir)
);
}

Expand Down Expand Up @@ -249,7 +251,7 @@ private function generateContent()
array(
'state' => -1,
'note' => 'FAIL',
'desc' => 'At least one database extension is required to install Icinga 2 Web'
'desc' => 'At least one database extension is required to install icingaweb'
)
);
}
Expand Down Expand Up @@ -277,7 +279,7 @@ private function generateContent()
array(
'state' => -1,
'note' => 'FAIL',
'desc' => 'At least one database adapter is required to install Icinga 2 Web'
'desc' => 'At least one database adapter is required to install icingaweb'
)
);
}
Expand Down Expand Up @@ -319,15 +321,15 @@ private function generateContent()
array(
'state' => $this->correctPhpVersion ? 1 : -1,
'note' => $this->correctPhpVersion ? 'OK' : 'FAIL',
'desc' => 'Icinga 2 Web requires PHP version 5.3.x or 5.4.x'
'desc' => 'icingaweb requires PHP version 5.3.x or 5.4.x'
)
);
array_push(
$content,
array(
'state' => $this->shortOpenTagEnabled ? 1 : 0,
'note' => $this->shortOpenTagEnabled ? 'OK' : 'WARNING',
'desc' => 'Icinga 2 Web makes use of the PHP short open tag <?='
'desc' => 'icingaweb makes use of the PHP short open tag <?='
)
);

Expand All @@ -348,7 +350,7 @@ private function generateContent()
array(
'state' => $this->validApacheConfig ? 1 : -1,
'note' => $this->validApacheConfig ? 'OK' : 'FAIL',
'desc' => 'Icinga 2 Web requires that the use of .htaccess files is allowed',
'desc' => 'icingaweb requires that the use of .htaccess files is allowed',
'help' => 'If this fails you might need to set AllowOverride appropriately or it'
. ' indicates that mod_rewrite is not enabled in your environment.'
)
Expand All @@ -363,6 +365,14 @@ private function generateContent()
'desc' => 'The configuration directory needs to be read-/writable by the PHP user'
)
);
array_push(
$content,
array(
'state' => $this->pathAccess['log'] ? 1 : 0,
'note' => $this->pathAccess['log'] ? 'OK' : 'WARNING',
'desc' => 'The log directory needs to be read-/writable by the PHP user'
)
);

return $content;
}
Expand Down
25 changes: 22 additions & 3 deletions install/application/Wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ class Wizard
*/
private $configDir;

/**
* Logging directory
*
* @var string
*/
private $logDir;

/**
* View object
*
Expand Down Expand Up @@ -111,6 +118,16 @@ public function getConfigurationDir()
return $this->configDir;
}

/**
* Return the actual logging directory
*
* @return string
*/
public function getLoggingDir()
{
return $this->logDir;
}

/**
* Return the actual front controller
*
Expand All @@ -137,19 +154,20 @@ public function getViewRenderer()
* @param string $configDir The path to the configuration directory to use
* @return self
*/
public static function start($configDir)
public static function start($configDir, $logDir)
{
$wizard = self::getInstance();
$wizard->setup($configDir);
$wizard->setup($configDir, $logDir);
return $wizard;
}

/**
* Finalise this wizard's initialisation
*
* @param string $configDir The path to the configuration directory to use
* @param string $logDir The path to the logging directory to use
*/
private function setup($configDir)
private function setup($configDir, $logDir)
{
Zend_Layout::startMvc(
array(
Expand All @@ -160,6 +178,7 @@ private function setup($configDir)
$this->setupFrontController();
$this->setupViewRenderer();
$this->configDir = $configDir;
$this->logDir = $logDir;
}

/**
Expand Down
14 changes: 12 additions & 2 deletions install/application/forms/AuthConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ public function create()
{
$this->addNote('Authentication & Preferences', 1);

$this->addNote(
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut' .
' labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores' .
' et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem' .
' ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et' .
' dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.' .
' Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'
);

$this->addNote('Default admin user', 2);

$this->addElement(
Expand All @@ -49,7 +58,8 @@ public function create()
'label' => 'Username',
'helptext' => 'The name of the default admin user.',
'required' => true,
'allowEmpty' => false
'allowEmpty' => false,
'value' => 'icingaadmin'
)
);
$this->addElement(
Expand Down Expand Up @@ -192,7 +202,7 @@ public function isValid($data)
$isValid = $message === 'OK';

if (!$isValid) {
$this->addErrorNote('Invalid LDAP authentication details: ' . $message, 9);
$this->addErrorNote('Invalid LDAP authentication details: ' . $message, 10);
}
}

Expand Down
24 changes: 16 additions & 8 deletions install/application/forms/BackendConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,26 @@ public function create()
{
$this->addNote('Backend configuration', 1);

$this->addNote(
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut' .
' labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores' .
' et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem' .
' ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et' .
' dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.' .
' Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'
);

$this->addNote('IDO - Icinga Data Out', 2);

$this->addElement(
'text',
'backend_name',
array(
'label' => 'Backend name',
'helptext' => 'This is the name internally used by Icinga 2 Web to identify this backend.',
'helptext' => 'This is the name internally used by icingaweb to identify this backend.',
'required' => true,
'allowEmpty' => false,
'value' => 'icinga2ido'
'value' => 'icingaido'
)
);
$this->addElement(
Expand Down Expand Up @@ -77,8 +86,7 @@ public function create()
'backend_resource',
array(
'label' => 'Resource name',
'helptext' => 'This is the name internally used by Icinga 2 Web'
. ' to identify this database store.',
'helptext' => 'This is the name internally used by icingaweb to identify this database store.',
'required' => true,
'allowEmpty' => false
)
Expand Down Expand Up @@ -165,10 +173,10 @@ public function create()
'backend_statusdat_name',
array(
'label' => 'Backend name',
'helptext' => 'This is the name internally used by Icinga 2 Web to identify this backend.',
'helptext' => 'This is the name internally used by icingaweb to identify this backend.',
'required' => true,
'allowEmpty' => false,
'value' => 'icinga2dat'
'value' => 'icingadat'
)
);
$this->addElement(
Expand Down Expand Up @@ -212,10 +220,10 @@ public function create()
'backend_livestatus_name',
array(
'label' => 'Backend name',
'helptext' => 'This is the name internally used by Icinga 2 Web to identify this backend.',
'helptext' => 'This is the name internally used by icingaweb to identify this backend.',
'required' => true,
'allowEmpty' => false,
'value' => 'icinga2live'
'value' => 'icingalive'
)
);
$this->addElement(
Expand Down
34 changes: 14 additions & 20 deletions install/application/forms/DbConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
namespace Icinga\Installer\Pages;

use \Zend_Config;
use \Icinga\Installer\Validators\PasswordValidator;

/**
* Wizard-Page that prompts the user for database configuration details
Expand All @@ -40,17 +39,26 @@ public function create()
{
$this->addNote('Database configuration', 1);

$this->addNote(
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut' .
' labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores' .
' et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem' .
' ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et' .
' dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.' .
' Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'
);

$this->addNote('Primary database store to use', 2);

$this->addElement(
'text',
'db_resource',
array(
'label' => 'Resource name',
'helptext' => 'This is the name internally used by Icinga 2 Web to identify this database store.',
'helptext' => 'This is the name internally used by icingaweb to identify this database store.',
'required' => true,
'allowEmpty' => false,
'value' => 'icinga2web'
'value' => 'icingaweb'
)
);
$this->addElement(
Expand Down Expand Up @@ -93,7 +101,7 @@ public function create()
'helptext' => 'The name of this database.',
'required' => true,
'allowEmpty' => false,
'value' => 'icinga2web'
'value' => 'icingaweb'
)
);
$this->addElement(
Expand All @@ -104,7 +112,7 @@ public function create()
'helptext' => 'The username to use for authentication with this database.',
'required' => true,
'allowEmpty' => false,
'value' => 'icinga2web'
'value' => 'icingaweb'
)
);
$this->addElement(
Expand All @@ -117,20 +125,6 @@ public function create()
'allowEmpty' => false
)
);
$this->addElement(
'password',
'db_password2',
array(
'label' => 'Password confirmation',
'helptext' => 'Please enter the password a second time to avoid mistakes.',
'required' => true,
'allowEmpty' => false
)
);

$passwordValidator = new PasswordValidator();
$passwordValidator->setCounterpart('db_password2');
$this->getElement('db_password')->addValidator($passwordValidator);

$this->setSubmitLabel('Continue');
}
Expand Down Expand Up @@ -162,7 +156,7 @@ public function isValid($data)
$isValid = $message === 'OK';

if (!$isValid) {
$this->addErrorNote('Database connection could not be established: ' . $message, 2);
$this->addErrorNote('Database connection could not be established: ' . $message, 3);
}
}

Expand Down
2 changes: 1 addition & 1 deletion install/application/forms/RequirementsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function create()
if ($this->getReport()->isOk()) {
$this->addNote(
'<span style="font-weight:bold;">All required software and packages available.</span>'
. ' You can now start configuring your new Icinga 2 Web installation!'
. ' You can now start configuring your new icingaweb installation!'
);
$this->setSubmitLabel('Continue');
} else {
Expand Down
2 changes: 1 addition & 1 deletion install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@

use \Icinga\Installer\Wizard;

Wizard::start(realpath(__DIR__ . '/../config/'))->dispatch();
Wizard::start(realpath(__DIR__ . '/../config/'), realpath(__DIR__ . '/../var/log'))->dispatch();

0 comments on commit 4a2a7ae

Please sign in to comment.