mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-11-04 05:05:01 +01:00 
			
		
		
		
	
							parent
							
								
									24d0999fa4
								
							
						
					
					
						commit
						04630a20be
					
				@ -3,7 +3,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Icinga\Module\Monitoring;
 | 
					namespace Icinga\Module\Monitoring;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Icinga\Application\Platform;
 | 
					 | 
				
			||||||
use Icinga\Web\Form;
 | 
					use Icinga\Web\Form;
 | 
				
			||||||
use Icinga\Web\Wizard;
 | 
					use Icinga\Web\Wizard;
 | 
				
			||||||
use Icinga\Web\Request;
 | 
					use Icinga\Web\Request;
 | 
				
			||||||
@ -17,6 +16,7 @@ use Icinga\Module\Monitoring\Forms\Setup\InstancePage;
 | 
				
			|||||||
use Icinga\Module\Monitoring\Forms\Setup\SecurityPage;
 | 
					use Icinga\Module\Monitoring\Forms\Setup\SecurityPage;
 | 
				
			||||||
use Icinga\Module\Monitoring\Forms\Setup\IdoResourcePage;
 | 
					use Icinga\Module\Monitoring\Forms\Setup\IdoResourcePage;
 | 
				
			||||||
use Icinga\Module\Monitoring\Forms\Setup\LivestatusResourcePage;
 | 
					use Icinga\Module\Monitoring\Forms\Setup\LivestatusResourcePage;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement\PhpModuleRequirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Monitoring Module Setup Wizard
 | 
					 * Monitoring Module Setup Wizard
 | 
				
			||||||
@ -137,19 +137,15 @@ class MonitoringWizard extends Wizard implements SetupWizard
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $requirements = new Requirements();
 | 
					        $requirements = new Requirements();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
            'existing_php_mod_sockets',
 | 
					            'optional'      => true,
 | 
				
			||||||
            mt('monitoring', 'PHP Module: Sockets'),
 | 
					            'condition'     => 'Sockets',
 | 
				
			||||||
            mt(
 | 
					            'description'   => mt(
 | 
				
			||||||
                'monitoring',
 | 
					                'monitoring',
 | 
				
			||||||
                'In case it\'s desired that a TCP connection is being used by Icinga Web 2 to'
 | 
					                'In case it\'s desired that a TCP connection is being used by Icinga Web 2 to'
 | 
				
			||||||
                . ' access a Livestatus interface, the Sockets module for PHP is required.'
 | 
					                . ' access a Livestatus interface, the Sockets module for PHP is required.'
 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('sockets'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('sockets') ? mt('monitoring', 'The PHP Module sockets is available.') : (
 | 
					 | 
				
			||||||
                mt('monitoring', 'The PHP Module sockets is not available.')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $requirements;
 | 
					        return $requirements;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										28
									
								
								modules/setup/library/Setup/Requirement/ClassRequirement.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								modules/setup/library/Setup/Requirement/ClassRequirement.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Icinga\Application\Platform;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ClassRequirement extends Requirement
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected function evaluate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $classNameOrPath = $this->getCondition();
 | 
				
			||||||
 | 
					        if (Platform::classExists($classNameOrPath)) {
 | 
				
			||||||
 | 
					            $this->setStateText(sprintf(
 | 
				
			||||||
 | 
					                mt('setup', 'The %s is available.', 'setup.requirement.class'),
 | 
				
			||||||
 | 
					                $this->getAlias() ?: $classNameOrPath . ' ' . mt('setup', 'class', 'setup.requirement.class')
 | 
				
			||||||
 | 
					            ));
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $this->setStateText(sprintf(
 | 
				
			||||||
 | 
					                mt('setup', 'The %s is missing.', 'setup.requirement.class'),
 | 
				
			||||||
 | 
					                $this->getAlias() ?: $classNameOrPath . ' ' . mt('setup', 'class', 'setup.requirement.class')
 | 
				
			||||||
 | 
					            ));
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ConfigDirectoryRequirement extends Requirement
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function getTitle()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $title = parent::getTitle();
 | 
				
			||||||
 | 
					        if ($title === null) {
 | 
				
			||||||
 | 
					            return mt('setup', 'Read- and writable configuration directory');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected function evaluate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $path = $this->getCondition();
 | 
				
			||||||
 | 
					        if (file_exists($path)) {
 | 
				
			||||||
 | 
					            $readable = is_readable($path);
 | 
				
			||||||
 | 
					            if ($readable && is_writable($path)) {
 | 
				
			||||||
 | 
					                $this->setStateText(sprintf(mt('setup', 'The directory %s is read- and writable.'), $path));
 | 
				
			||||||
 | 
					                return true;
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                $this->setStateText(sprintf(
 | 
				
			||||||
 | 
					                    $readable
 | 
				
			||||||
 | 
					                        ? mt('setup', 'The directory %s is not writable.')
 | 
				
			||||||
 | 
					                        : mt('setup', 'The directory %s is not readable.'),
 | 
				
			||||||
 | 
					                    $path
 | 
				
			||||||
 | 
					                ));
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $this->setStateText(sprintf(mt('setup', 'The directory %s does not exist.'), $path));
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										27
									
								
								modules/setup/library/Setup/Requirement/OSRequirement.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								modules/setup/library/Setup/Requirement/OSRequirement.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Icinga\Application\Platform;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class OSRequirement extends Requirement
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function getTitle()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $title = parent::getTitle();
 | 
				
			||||||
 | 
					        if ($title === null) {
 | 
				
			||||||
 | 
					            return sprintf(mt('setup', '%s Platform'), ucfirst($this->getCondition()));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected function evaluate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $phpOS = Platform::getOperatingSystemName();
 | 
				
			||||||
 | 
					        $this->setStateText(sprintf(mt('setup', 'You are running PHP on a %s system.'), ucfirst($phpOS)));
 | 
				
			||||||
 | 
					        return strtolower($phpOS) === strtolower($this->getCondition());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Icinga\Application\Platform;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PhpConfigRequirement extends Requirement
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected function evaluate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        list($configDirective, $value) = $this->getCondition();
 | 
				
			||||||
 | 
					        $configValue = Platform::getPhpConfig($configDirective);
 | 
				
			||||||
 | 
					        $this->setStateText(
 | 
				
			||||||
 | 
					            $configValue
 | 
				
			||||||
 | 
					                ? sprintf(mt('setup', 'The PHP config `%s\' is set to "%s".'), $configDirective, $configValue)
 | 
				
			||||||
 | 
					                : sprintf(mt('setup', 'The PHP config `%s\' is not defined.'), $configDirective)
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        return is_bool($value) ? $configValue == $value : $configValue === $value;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Icinga\Application\Platform;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PhpModuleRequirement extends Requirement
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function getTitle()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $title = parent::getTitle();
 | 
				
			||||||
 | 
					        if ($title === $this->getAlias()) {
 | 
				
			||||||
 | 
					            if ($title === null) {
 | 
				
			||||||
 | 
					                $title = $this->getCondition();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return sprintf(mt('setup', 'PHP Module: %s'), $title);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected function evaluate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $moduleName = $this->getCondition();
 | 
				
			||||||
 | 
					        if (Platform::extensionLoaded($moduleName)) {
 | 
				
			||||||
 | 
					            $this->setStateText(sprintf(
 | 
				
			||||||
 | 
					                mt('setup', 'The PHP module %s is available.'),
 | 
				
			||||||
 | 
					                $this->getAlias() ?: $moduleName
 | 
				
			||||||
 | 
					            ));
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $this->setStateText(sprintf(
 | 
				
			||||||
 | 
					                mt('setup', 'The PHP module %s is missing.'),
 | 
				
			||||||
 | 
					                $this->getAlias() ?: $moduleName
 | 
				
			||||||
 | 
					            ));
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Icinga\Application\Platform;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PhpVersionRequirement extends Requirement
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function getTitle()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $title = parent::getTitle();
 | 
				
			||||||
 | 
					        if ($title === null) {
 | 
				
			||||||
 | 
					            return mt('setup', 'PHP Version');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected function evaluate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $phpVersion = Platform::getPhpVersion();
 | 
				
			||||||
 | 
					        $this->setStateText(sprintf(mt('setup', 'You are running PHP version %s.'), $phpVersion));
 | 
				
			||||||
 | 
					        list($operator, $requiredVersion) = $this->getCondition();
 | 
				
			||||||
 | 
					        return version_compare($phpVersion, $requiredVersion, $operator);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -9,7 +9,6 @@ use Icinga\Web\Wizard;
 | 
				
			|||||||
use Icinga\Web\Request;
 | 
					use Icinga\Web\Request;
 | 
				
			||||||
use Icinga\Application\Config;
 | 
					use Icinga\Application\Config;
 | 
				
			||||||
use Icinga\Application\Icinga;
 | 
					use Icinga\Application\Icinga;
 | 
				
			||||||
use Icinga\Application\Platform;
 | 
					 | 
				
			||||||
use Icinga\Module\Setup\Forms\ModulePage;
 | 
					use Icinga\Module\Setup\Forms\ModulePage;
 | 
				
			||||||
use Icinga\Module\Setup\Forms\WelcomePage;
 | 
					use Icinga\Module\Setup\Forms\WelcomePage;
 | 
				
			||||||
use Icinga\Module\Setup\Forms\SummaryPage;
 | 
					use Icinga\Module\Setup\Forms\SummaryPage;
 | 
				
			||||||
@ -29,8 +28,13 @@ use Icinga\Module\Setup\Steps\GeneralConfigStep;
 | 
				
			|||||||
use Icinga\Module\Setup\Steps\ResourceStep;
 | 
					use Icinga\Module\Setup\Steps\ResourceStep;
 | 
				
			||||||
use Icinga\Module\Setup\Steps\AuthenticationStep;
 | 
					use Icinga\Module\Setup\Steps\AuthenticationStep;
 | 
				
			||||||
use Icinga\Module\Setup\Utils\EnableModuleStep;
 | 
					use Icinga\Module\Setup\Utils\EnableModuleStep;
 | 
				
			||||||
use Icinga\Module\Setup\Utils\MakeDirStep;
 | 
					 | 
				
			||||||
use Icinga\Module\Setup\Utils\DbTool;
 | 
					use Icinga\Module\Setup\Utils\DbTool;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement\OSRequirement;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement\ClassRequirement;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement\PhpConfigRequirement;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement\PhpModuleRequirement;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement\PhpVersionRequirement;
 | 
				
			||||||
 | 
					use Icinga\Module\Setup\Requirement\ConfigDirectoryRequirement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Icinga Web 2 Setup Wizard
 | 
					 * Icinga Web 2 Setup Wizard
 | 
				
			||||||
@ -351,194 +355,147 @@ class WebWizard extends Wizard implements SetupWizard
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $requirements = new Requirements();
 | 
					        $requirements = new Requirements();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $phpVersion = Platform::getPhpVersion();
 | 
					        $requirements->add(new PhpVersionRequirement(array(
 | 
				
			||||||
        $requirements->addMandatory(
 | 
					            'condition'     => array('>=', '5.3.2'),
 | 
				
			||||||
            'php_version_>=_5_3_2',
 | 
					            'description'   => mt(
 | 
				
			||||||
            mt('setup', 'PHP Version'),
 | 
					 | 
				
			||||||
            mt(
 | 
					 | 
				
			||||||
                'setup',
 | 
					                'setup',
 | 
				
			||||||
                'Running Icinga Web 2 requires PHP version 5.3.2. Advanced features'
 | 
					                'Running Icinga Web 2 requires PHP version 5.3.2. Advanced features'
 | 
				
			||||||
                . ' like the built-in web server require PHP version 5.4.'
 | 
					                . ' like the built-in web server require PHP version 5.4.'
 | 
				
			||||||
            ),
 | 
					            )
 | 
				
			||||||
            version_compare($phpVersion, '5.3.2', '>='),
 | 
					        )));
 | 
				
			||||||
            sprintf(mt('setup', 'You are running PHP version %s.'), $phpVersion)
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $defaultTimezone = Platform::getPhpConfig('date.timezone');
 | 
					        $requirements->add(new PhpConfigRequirement(array(
 | 
				
			||||||
        $requirements->addMandatory(
 | 
					            'condition'     => array('date.timezone', true),
 | 
				
			||||||
            'existing_default_timezone',
 | 
					            'title'         => mt('setup', 'Default Timezone'),
 | 
				
			||||||
            mt('setup', 'Default Timezone'),
 | 
					            'description'   => sprintf(
 | 
				
			||||||
            sprintf(
 | 
					 | 
				
			||||||
                mt('setup', 'It is required that a default timezone has been set using date.timezone in %s.'),
 | 
					                mt('setup', 'It is required that a default timezone has been set using date.timezone in %s.'),
 | 
				
			||||||
                php_ini_loaded_file() ?: 'php.ini'
 | 
					                php_ini_loaded_file() ?: 'php.ini'
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
            $defaultTimezone,
 | 
					        )));
 | 
				
			||||||
            $defaultTimezone ? sprintf(mt('setup', 'Your default timezone is: %s'), $defaultTimezone) : (
 | 
					 | 
				
			||||||
                mt('setup', 'You did not define a default timezone.')
 | 
					 | 
				
			||||||
            )
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new OSRequirement(array(
 | 
				
			||||||
            'platform=linux',
 | 
					            'optional'      => true,
 | 
				
			||||||
            mt('setup', 'Linux Platform'),
 | 
					            'condition'     => 'linux',
 | 
				
			||||||
            mt(
 | 
					            'description'   => mt(
 | 
				
			||||||
                'setup',
 | 
					                'setup',
 | 
				
			||||||
                'Icinga Web 2 is developed for and tested on Linux. While we cannot'
 | 
					                'Icinga Web 2 is developed for and tested on Linux. While we cannot'
 | 
				
			||||||
                . ' guarantee they will, other platforms may also perform as well.'
 | 
					                . ' guarantee they will, other platforms may also perform as well.'
 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
            Platform::isLinux(),
 | 
					 | 
				
			||||||
            sprintf(mt('setup', 'You are running PHP on a %s system.'), Platform::getOperatingSystemName())
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $requirements->addMandatory(
 | 
					 | 
				
			||||||
            'existing_php_mod_openssl',
 | 
					 | 
				
			||||||
            mt('setup', 'PHP Module: OpenSSL'),
 | 
					 | 
				
			||||||
            mt('setup', 'The PHP module for OpenSSL is required to generate cryptographically safe password salts.'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('openssl'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('openssl') ? mt('setup', 'The PHP module for OpenSSL is available.') : (
 | 
					 | 
				
			||||||
                mt('setup', 'The PHP module for OpenSSL is missing.')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
            'existing_php_mod_json',
 | 
					            'condition'     => 'OpenSSL',
 | 
				
			||||||
            mt('setup', 'PHP Module: JSON'),
 | 
					            'description'   => mt(
 | 
				
			||||||
            mt('setup', 'The JSON module for PHP is required for various export functionalities as well as APIs.'),
 | 
					                'setup',
 | 
				
			||||||
            Platform::extensionLoaded('json'),
 | 
					                'The PHP module for OpenSSL is required to generate cryptographically safe password salts.'
 | 
				
			||||||
            Platform::extensionLoaded('json') ? mt('setup', 'The PHP module JSON is available.') : (
 | 
					 | 
				
			||||||
                mt('setup', 'The PHP module JSON is missing.')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
            'existing_php_mod_ldap',
 | 
					            'optional'      => true,
 | 
				
			||||||
            mt('setup', 'PHP Module: LDAP'),
 | 
					            'condition'     => 'JSON',
 | 
				
			||||||
            mt('setup', 'If you\'d like to authenticate users using LDAP the corresponding PHP module is required'),
 | 
					            'description'   => mt(
 | 
				
			||||||
            Platform::extensionLoaded('ldap'),
 | 
					                'setup',
 | 
				
			||||||
            Platform::extensionLoaded('ldap') ? mt('setup', 'The PHP module LDAP is available') : (
 | 
					                'The JSON module for PHP is required for various export functionalities as well as APIs.'
 | 
				
			||||||
                mt('setup', 'The PHP module LDAP is missing')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
            'existing_php_mod_intl',
 | 
					            'optional'      => true,
 | 
				
			||||||
            mt('setup', 'PHP Module: INTL'),
 | 
					            'condition'     => 'LDAP',
 | 
				
			||||||
            mt(
 | 
					            'description'   => mt(
 | 
				
			||||||
 | 
					                'setup',
 | 
				
			||||||
 | 
					                'If you\'d like to authenticate users using LDAP the corresponding PHP module is required.'
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
 | 
					            'optional'      => true,
 | 
				
			||||||
 | 
					            'condition'     => 'INTL',
 | 
				
			||||||
 | 
					            'description'   => mt(
 | 
				
			||||||
                'setup',
 | 
					                'setup',
 | 
				
			||||||
                'If you want your users to benefit from language, timezone and date/time'
 | 
					                'If you want your users to benefit from language, timezone and date/time'
 | 
				
			||||||
                . ' format negotiation, the INTL module for PHP is required.'
 | 
					                . ' format negotiation, the INTL module for PHP is required.'
 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('intl'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('intl') ? mt('setup', 'The PHP module INTL is available') : (
 | 
					 | 
				
			||||||
                mt('setup', 'The PHP module INTL is missing')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // TODO(6172): Remove this requirement once we do not ship dompdf with Icinga Web 2 anymore
 | 
					        // TODO(6172): Remove this requirement once we do not ship dompdf with Icinga Web 2 anymore
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
            'existing_php_mod_dom',
 | 
					            'optional'      => true,
 | 
				
			||||||
            mt('setup', 'PHP Module: DOM'),
 | 
					            'condition'     => 'DOM',
 | 
				
			||||||
            mt('setup', 'To be able to export views and reports to PDF, the DOM module for PHP is required.'),
 | 
					            'description'   => mt(
 | 
				
			||||||
            Platform::extensionLoaded('dom'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('dom') ? mt('setup', 'The PHP module DOM is available') : (
 | 
					 | 
				
			||||||
                mt('setup', 'The PHP module DOM is missing')
 | 
					 | 
				
			||||||
            )
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $requirements->addOptional(
 | 
					 | 
				
			||||||
            'existing_php_mod_gd',
 | 
					 | 
				
			||||||
            mt('setup', 'PHP Module: GD'),
 | 
					 | 
				
			||||||
            mt(
 | 
					 | 
				
			||||||
                'setup',
 | 
					                'setup',
 | 
				
			||||||
                'In case you want views being exported to PDF,'
 | 
					                'To be able to export views and reports to PDF, the DOM module for PHP is required.'
 | 
				
			||||||
                . ' you\'ll need the GD extension for PHP.'
 | 
					 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('gd'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('gd') ? mt('setup', 'The PHP module GD is available') : (
 | 
					 | 
				
			||||||
                mt('setup', 'The PHP module GD is missing')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
            'existing_php_mod_imagick',
 | 
					            'optional'      => true,
 | 
				
			||||||
            mt('setup', 'PHP Module: Imagick'),
 | 
					            'condition'     => 'GD',
 | 
				
			||||||
            mt(
 | 
					            'description'   => mt(
 | 
				
			||||||
                'setup',
 | 
					                'setup',
 | 
				
			||||||
                'In case you want graphs being exported to PDF as well'
 | 
					                'In case you want views being exported to PDF, you\'ll need the GD extension for PHP.'
 | 
				
			||||||
                . ', you\'ll need the ImageMagick extension for PHP.'
 | 
					 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('imagick'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('imagick') ? mt('setup', 'The PHP module Imagick is available') : (
 | 
					 | 
				
			||||||
                mt('setup', 'The PHP module Imagick is missing')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
            'existing_php_mod_pdo_mysql',
 | 
					            'optional'      => true,
 | 
				
			||||||
            mt('setup', 'PHP Module: PDO-MySQL'),
 | 
					            'condition'     => 'Imagick',
 | 
				
			||||||
            mt(
 | 
					            'description'   => mt(
 | 
				
			||||||
 | 
					                'setup',
 | 
				
			||||||
 | 
					                'In case you want graphs being exported to PDF as well, you\'ll need the ImageMagick extension for PHP.'
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
 | 
					            'optional'      => true,
 | 
				
			||||||
 | 
					            'condition'     => 'mysql',
 | 
				
			||||||
 | 
					            'alias'         => 'PDO-MySQL',
 | 
				
			||||||
 | 
					            'description'   => mt(
 | 
				
			||||||
                'setup',
 | 
					                'setup',
 | 
				
			||||||
                'Is Icinga Web 2 supposed to access a MySQL database the PDO-MySQL module for PHP is required.'
 | 
					                'Is Icinga Web 2 supposed to access a MySQL database the PDO-MySQL module for PHP is required.'
 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('mysql'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('mysql') ? mt('setup', 'The PHP module PDO-MySQL is available.') : (
 | 
					 | 
				
			||||||
                mt('setup', 'The PHP module PDO-MySQL is missing.')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $requirements->addOptional(
 | 
					        $requirements->add(new PhpModuleRequirement(array(
 | 
				
			||||||
            'existing_php_mod_pdo_pgsql',
 | 
					            'optional'      => true,
 | 
				
			||||||
            mt('setup', 'PHP Module: PDO-PostgreSQL'),
 | 
					            'condition'     => 'pgsql',
 | 
				
			||||||
            mt(
 | 
					            'alias'         => 'PDO-PostgreSQL',
 | 
				
			||||||
 | 
					            'description'   => mt(
 | 
				
			||||||
                'setup',
 | 
					                'setup',
 | 
				
			||||||
                'Is Icinga Web 2 supposed to access a PostgreSQL database'
 | 
					                'Is Icinga Web 2 supposed to access a PostgreSQL database'
 | 
				
			||||||
                . ' the PDO-PostgreSQL module for PHP is required.'
 | 
					                . ' the PDO-PostgreSQL module for PHP is required.'
 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('pgsql'),
 | 
					 | 
				
			||||||
            Platform::extensionLoaded('pgsql') ? mt('setup', 'The PHP module PDO-PostgreSQL is available.') : (
 | 
					 | 
				
			||||||
                mt('setup', 'The PHP module PDO-PostgreSQL is missing.')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $mysqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Mysql');
 | 
					        $requirements->add(new ClassRequirement(array(
 | 
				
			||||||
        $requirements->addOptional(
 | 
					            'optional'      => true,
 | 
				
			||||||
            'existing_class_Zend_Db_Adapter_Pdo_Mysql',
 | 
					            'condition'     => 'Zend_Db_Adapter_Pdo_Mysql',
 | 
				
			||||||
            mt('setup', 'Zend Database Adapter For MySQL'),
 | 
					            'alias'         => mt('setup', 'Zend database adapter for MySQL'),
 | 
				
			||||||
            mt('setup', 'The Zend database adapter for MySQL is required to access a MySQL database.'),
 | 
					            'description'   => mt(
 | 
				
			||||||
            $mysqlAdapterFound,
 | 
					                'setup',
 | 
				
			||||||
            $mysqlAdapterFound ? mt('setup', 'The Zend database adapter for MySQL is available.') : (
 | 
					                'The Zend database adapter for MySQL is required to access a MySQL database.'
 | 
				
			||||||
                mt('setup', 'The Zend database adapter for MySQL is missing.')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $pgsqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Pgsql');
 | 
					        $requirements->add(new ClassRequirement(array(
 | 
				
			||||||
        $requirements->addOptional(
 | 
					            'optional'      => true,
 | 
				
			||||||
            'existing_class_Zend_Db_Adapter_Pdo_Pgsql',
 | 
					            'condition'     => 'Zend_Db_Adapter_Pdo_Pgsql',
 | 
				
			||||||
            mt('setup', 'Zend Database Adapter For PostgreSQL'),
 | 
					            'alias'         => mt('setup', 'Zend database adapter for PostgreSQL'),
 | 
				
			||||||
            mt('setup', 'The Zend database adapter for PostgreSQL is required to access a PostgreSQL database.'),
 | 
					            'description'   => mt(
 | 
				
			||||||
            $pgsqlAdapterFound,
 | 
					                'setup',
 | 
				
			||||||
            $pgsqlAdapterFound ? mt('setup', 'The Zend database adapter for PostgreSQL is available.') : (
 | 
					                'The Zend database adapter for PostgreSQL is required to access a PostgreSQL database.'
 | 
				
			||||||
                mt('setup', 'The Zend database adapter for PostgreSQL is missing.')
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $configDir = Icinga::app()->getConfigDir();
 | 
					        $requirements->add(new ConfigDirectoryRequirement(array(
 | 
				
			||||||
        $requirements->addMandatory(
 | 
					            'condition'     => Icinga::app()->getConfigDir(),
 | 
				
			||||||
            'writable_directory_' . $configDir,
 | 
					            'description'   => mt(
 | 
				
			||||||
            mt('setup', 'Writable Config Directory'),
 | 
					 | 
				
			||||||
            mt(
 | 
					 | 
				
			||||||
                'setup',
 | 
					                'setup',
 | 
				
			||||||
                'The Icinga Web 2 configuration directory defaults to "/etc/icingaweb2", if' .
 | 
					                'The Icinga Web 2 configuration directory defaults to "/etc/icingaweb2", if' .
 | 
				
			||||||
                ' not explicitly set in the environment variable "ICINGAWEB_CONFIGDIR".'
 | 
					                ' not explicitly set in the environment variable "ICINGAWEB_CONFIGDIR".'
 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
            is_writable($configDir),
 | 
					 | 
				
			||||||
            sprintf(
 | 
					 | 
				
			||||||
                is_writable($configDir) ? mt('setup', 'The current configuration directory is writable: %s') : (
 | 
					 | 
				
			||||||
                    mt('setup', 'The current configuration directory is not writable: %s')
 | 
					 | 
				
			||||||
                ),
 | 
					 | 
				
			||||||
                $configDir
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        );
 | 
					        )));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        foreach ($this->getWizards() as $wizard) {
 | 
					        foreach ($this->getWizards() as $wizard) {
 | 
				
			||||||
            $requirements->merge($wizard->getRequirements());
 | 
					            $requirements->merge($wizard->getRequirements());
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user