Do not set UTC in index.php

refs #5638
fixes #5530
This commit is contained in:
Eric Lippmann 2014-02-12 14:51:04 +01:00
parent a630a96e01
commit 3e04122e34
7 changed files with 19 additions and 27 deletions

View File

@ -11,6 +11,5 @@ set_include_path(
);
require_once 'Icinga/Application/Cli.php';
date_default_timezone_set('UTC');
$app = Cli::start(dirname(__FILE__) . '/../config/')->dispatch();

View File

@ -32,7 +32,6 @@ namespace Icinga\Application;
use \DateTimeZone;
use \Exception;
use \Icinga\Application\Modules\Manager as ModuleManager;
use \Icinga\Application\Config;
use \Icinga\Exception\ConfigurationError;
use \Icinga\Util\DateTimeFactory;
use \Icinga\Util\Translator;
@ -124,7 +123,7 @@ abstract class ApplicationBootstrap
*/
protected function __construct($configDir)
{
$this->libDir = realpath(__DIR__. '/../..');
$this->libDir = realpath(__DIR__ . '/../..');
if (!defined('ICINGA_LIBDIR')) {
define('ICINGA_LIBDIR', $this->libDir);
@ -257,9 +256,7 @@ abstract class ApplicationBootstrap
*/
public static function start($configDir)
{
$class = get_called_class();
/** @var ApplicationBootstrap $obj */
$application = new $class($configDir);
$application = new static($configDir);
$application->bootstrap();
if (Logger::hasErrorsOccurred()) {
@ -302,7 +299,7 @@ abstract class ApplicationBootstrap
*/
public function setupAutoloader()
{
require $this->libDir. '/Icinga/Application/Loader.php';
require $this->libDir . '/Icinga/Application/Loader.php';
$this->loader = new Loader();
$this->loader->registerNamespace('Icinga', $this->libDir. '/Icinga');
@ -368,11 +365,11 @@ abstract class ApplicationBootstrap
}
/**
* Load Configuration
* Load configuration
*
* @return self
*/
protected function setupConfig()
protected function loadConfig()
{
Config::$configDir = $this->configDir;
$this->config = Config::app();

View File

@ -61,7 +61,9 @@ class Cli extends ApplicationBootstrap
protected function bootstrap()
{
$this->assertRunningOnCli();
$this->setupConfig()
$this
->loadConfig()
->setupTimezone()
->setupInternationalization()
->parseBasicParams()
->fixLoggingConfig()

View File

@ -54,9 +54,10 @@ class EmbeddedWeb extends ApplicationBootstrap
*/
protected function bootstrap()
{
return $this->setupConfig()
->setupErrorHandling()
return $this
->loadConfig()
->setupTimezone()
->setupErrorHandling()
->setupModules();
}
}

View File

@ -29,18 +29,17 @@
namespace Icinga\Application;
use Icinga\Protocol\Ldap\Exception;
use \Zend_Config;
use \Zend_Log;
use \Zend_Log_Filter_Priority;
use \Zend_Log_Writer_Abstract;
use \Zend_Log_Exception;
use \Icinga\Exception\ConfigurationError;
use Icinga\Exception\ConfigurationError;
/**
* Singleton logger
* Zend_Log wrapper
*/
final class Logger
class Logger
{
/**
* Default log type

View File

@ -116,13 +116,14 @@ class Web extends ApplicationBootstrap
*/
protected function bootstrap()
{
return $this->setupConfig()
->setupErrorHandling()
->setupResourceFactory()
return $this
->loadConfig()
->setupSession()
->setupUser()
->setupInternationalization()
->setupTimezone()
->setupErrorHandling()
->setupResourceFactory()
->setupInternationalization()
->setupRequest()
->setupZendMvc()
->setupModuleManager()

View File

@ -2,13 +2,6 @@
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
/*
* 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/Web.php';
use Icinga\Application\Web;