diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index a1b5647e42..e8f55e7c57 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -183,6 +183,19 @@ public function dispatch() $this->frontController->dispatch(); } + /** + * Return whether this app has been installed + * + * @param string $configDir + * @return bool + */ + public static function isInstalled($configDir) + { + $application = new Web($configDir); + $config = $application->setupConfig()->getConfig(); + return $config->global->installed == 1; + } + /** * Prepare Zend MVC Base * diff --git a/public/install/configCheck/.htaccess b/public/configCheck/.htaccess similarity index 100% rename from public/install/configCheck/.htaccess rename to public/configCheck/.htaccess diff --git a/public/install/configCheck/index.html b/public/configCheck/index.html similarity index 100% rename from public/install/configCheck/index.html rename to public/configCheck/index.html diff --git a/public/index.php b/public/index.php index 891f736fba..89293267ce 100644 --- a/public/index.php +++ b/public/index.php @@ -1,7 +1,41 @@ + * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 + * @author Icinga Development Team + */ // {{{ICINGA_LICENSE_HEADER}}} +require_once realpath(__DIR__ . '/install/functions.php'); + +if (!is_zend_installed('1')) { + echo '

Zend Framework not found!

' + . 'The Zend Framework 1 is mandatory to successfully install and run this application.' + . ' Please go to zend.com' + . ' and install its latest version.'; + die; +} + /* * Set timezone before bootstrapping the application and therefore before calling `setupTimezone()` because in case an * error occurred whilst, the logger calls date/time functions which would generate a warning if the php.ini lacks a @@ -9,9 +43,17 @@ */ date_default_timezone_set('UTC'); -require_once dirname(__FILE__). '/../library/Icinga/Application/ApplicationBootstrap.php'; -require_once dirname(__FILE__). '/../library/Icinga/Application/Web.php'; +require_once realpath(__DIR__ . '/../library/Icinga/Application/ApplicationBootstrap.php'); +require_once realpath(__DIR__ . '/../library/Icinga/Application/Web.php'); +require_once realpath(__DIR__ . '/install/application/Wizard.php'); -use Icinga\Application\Web; +use \Icinga\Application\Web; +use \Icinga\Installer\Wizard; -Web::start(dirname(__FILE__) . '/../config/')->dispatch(); +$configDir = realpath(__DIR__ . '/../config/'); +if (Web::isInstalled($configDir)) { + Web::start($configDir)->dispatch(); +} else { + $logDir = realpath(__DIR__ . '/../var/log'); + Wizard::start($configDir, $logDir)->dispatch(); +} diff --git a/public/install/application/Wizard.php b/public/install/application/Wizard.php index 367d9cacec..1265c7278e 100644 --- a/public/install/application/Wizard.php +++ b/public/install/application/Wizard.php @@ -103,7 +103,7 @@ public static function getInstance() public function getApplicationDir() { if (!isset($this->appDir)) { - $this->appDir = realpath('application'); + $this->appDir = realpath(__DIR__); } return $this->appDir; } diff --git a/public/install/application/forms/BackendConfigForm.php b/public/install/application/forms/BackendConfigForm.php index 35c237b034..9fee69c80d 100644 --- a/public/install/application/forms/BackendConfigForm.php +++ b/public/install/application/forms/BackendConfigForm.php @@ -223,7 +223,7 @@ public function isValid($data) $this->addErrorNote('Invalid Status.dat backend: ' . $message, 5); } } elseif ($isValid && $data['backend_selection'] === 'type_live') { - $message = $this->checkLiveStatus($data['backend_livestatus_socket']); + $message = $this->checkLiveStatus($data['backend_live_socket']); $isValid = $message === 'OK'; if (!$isValid) { diff --git a/public/install/application/forms/WizardForm.php b/public/install/application/forms/WizardForm.php index b4b499912d..52c1c69282 100644 --- a/public/install/application/forms/WizardForm.php +++ b/public/install/application/forms/WizardForm.php @@ -35,21 +35,21 @@ require_once 'Zend/Form/Element/Submit.php'; require_once 'Zend/Form/Decorator/Abstract.php'; require_once realpath(__DIR__ . '/../validators/PasswordValidator.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Web/Form.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Web/Form/Element/Note.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Web/Form/Decorator/HelpText.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Web/Form/Decorator/BootstrapForm.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Util/ConfigAwareFactory.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Application/DbAdapterFactory.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Authentication/UserBackend.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Authentication/Backend/LdapUserBackend.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Protocol/Ldap/Connection.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Protocol/Ldap/LdapUtils.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Protocol/Ldap/Query.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Data/DatasourceInterface.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Protocol/Statusdat/IReader.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Protocol/Statusdat/Reader.php'); -require_once realpath(__DIR__ . '/../../../library/Icinga/Exception/ConfigurationError.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Web/Form.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Web/Form/Element/Note.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Web/Form/Decorator/HelpText.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Web/Form/Decorator/BootstrapForm.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Util/ConfigAwareFactory.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Application/DbAdapterFactory.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Authentication/UserBackend.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Authentication/Backend/LdapUserBackend.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Protocol/Ldap/Connection.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Protocol/Ldap/LdapUtils.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Protocol/Ldap/Query.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Data/DatasourceInterface.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Protocol/Statusdat/IReader.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Protocol/Statusdat/Reader.php'); +require_once realpath(__DIR__ . '/../../../../library/Icinga/Exception/ConfigurationError.php'); use \Exception; use \Zend_Config; diff --git a/public/install/application/layouts/scripts/layout.phtml b/public/install/application/layouts/scripts/layout.phtml index 6a5111abc6..7f3f0a9551 100644 --- a/public/install/application/layouts/scripts/layout.phtml +++ b/public/install/application/layouts/scripts/layout.phtml @@ -8,11 +8,11 @@ - +