Skip to content

Commit

Permalink
Fix installer source tree
Browse files Browse the repository at this point in the history
refs #3761
  • Loading branch information
Johannes Meyer committed Oct 10, 2013
1 parent 86bb531 commit 5832bd2
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 23 deletions.
13 changes: 13 additions & 0 deletions library/Icinga/Application/Web.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
File renamed without changes.
File renamed without changes.
50 changes: 46 additions & 4 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,59 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga 2 Web.
*
* Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}

require_once realpath(__DIR__ . '/install/functions.php');

if (!is_zend_installed('1')) {
echo '<h3>Zend Framework not found!</h3>'
. 'The Zend Framework 1 is mandatory to successfully install and run this application.'
. ' Please go to <a href="http://framework.zend.com/downloads/latest#ZF1">zend.com</a>'
. ' 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
* valid timezone.
*/
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();
}
2 changes: 1 addition & 1 deletion public/install/application/Wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion public/install/application/forms/BackendConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
30 changes: 15 additions & 15 deletions public/install/application/forms/WizardForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions public/install/application/layouts/scripts/layout.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<link rel="stylesheet" href="<?php echo $this->baseUrl('../public/css/vendor/bootstrap/bootstrap.min.css') ?>" media="screen">
<link rel="stylesheet" href="<?php echo $this->baseUrl('css/vendor/bootstrap/bootstrap.min.css') ?>" media="screen">

<!--
Not used until styling is clear (see #4550)
<link rel="stylesheet" href="<?php echo $this->baseUrl('../public/css.php') ?>">
<link rel="stylesheet" href="<?php echo $this->baseUrl('css.php') ?>">
-->
</head>
<body>
Expand Down

0 comments on commit 5832bd2

Please sign in to comment.