[icinga-checkins] icinga.org: icinga-web/jmosshammer/default: * Readded default. timezone and added default timezone set before agavi check

git at icinga.org git at icinga.org
Fri Aug 26 10:55:47 CEST 2011


Module: icinga-web
Branch: jmosshammer/default
Commit: 127d41fa74dff5af1c04569fc427f0235db7e076
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=127d41fa74dff5af1c04569fc427f0235db7e076

Author: Jannis Moßhammer <jannis.mosshammer at netways.de>
Date:   Fri Aug 26 10:55:36 2011 +0200

* Readded default.timezone and added default timezone set before agavi check

---

 app/config/translation.xml.in                      |    2 +-
 .../translator/AppKitTranslationManager.class.php  |   28 ++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/app/config/translation.xml.in b/app/config/translation.xml.in
index ce9e8ee..015ca54 100755
--- a/app/config/translation.xml.in
+++ b/app/config/translation.xml.in
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ae:configurations xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0" xmlns="http://agavi.org/agavi/config/parts/translation/1.0">
   <ae:configuration>
-	 <available_locales default_locale="en" >
+	 <available_locales default_locale="en" default_timezone="GMT">
 		<!-- German, Germany -->
 		<available_locale identifier="de_DE">
 		  <ae:parameter name="description">Deutsch</ae:parameter>
diff --git a/app/modules/AppKit/lib/translator/AppKitTranslationManager.class.php b/app/modules/AppKit/lib/translator/AppKitTranslationManager.class.php
index ab2ba32..722cee9 100644
--- a/app/modules/AppKit/lib/translator/AppKitTranslationManager.class.php
+++ b/app/modules/AppKit/lib/translator/AppKitTranslationManager.class.php
@@ -8,7 +8,35 @@
  */
 class AppKitTranslationManager extends AgaviTranslationManager {
     private $__localeLoaded = false;
+    public function initialize(AgaviContext $context, array $parameters = array()) {
+        $this->context = $context;
 
+		include(AgaviConfigCache::checkConfig(AgaviConfig::get('core.config_dir') . '/translation.xml'));
+		$this->loadSupplementalData();
+		$this->loadTimeZoneData();
+		$this->loadAvailableLocales();
+       
+       
+        
+		if($this->defaultLocaleIdentifier === null) {
+			throw new AgaviException('Tried to use the translation system without a default locale and without a locale set');
+		}
+		$this->setLocale($this->defaultLocaleIdentifier);
+
+		if($this->defaultTimeZone === null) {
+			$this->defaultTimeZone = date_default_timezone_get();
+		} else {
+            date_default_timezone_set($this->defaultTimeZone);
+        }
+        
+        
+		if($this->defaultTimeZone === 'System/Localtime') {
+			// http://trac.agavi.org/ticket/1008
+			throw new AgaviException("Your default timezone is 'System/Localtime', which likely means that you're running Debian, Ubuntu or some other Linux distribution that chose to include a useless and broken patch for system timezone database lookups into their PHP package, despite this very change being declined by the PHP development team for inclusion into PHP itself.\nThis pseudo-timezone, which is not defined in the standard 'tz' database used across many operating systems and applications, works for internal PHP classes and functions because the 'real' system timezone is resolved instead, but there is no way for an application to obtain the actual timezone name that 'System/Localtime' resolves to internally - information Agavi needs to perform accurate calculations and operations on dates and times.\n\nPlease set a correct timezone name (e.g. Europe/London) via 'date.timezone' in php.ini, use date_default_timezone_set() to set it in your code, or define a default timezone 
 for Agavi to use in translation.xml. If you have some minutes to spare, file a bug report with your operating system vendor about this problem.\n\nIf you'd like to learn more about this issue, please refer to http://trac.agavi.org/ticket/1008");
+		}
+        
+    }
+    
     public function loadCurrentLocale() {
         if ($this->__localeLoaded) {
             return parent::loadCurrentLocale();





More information about the icinga-checkins mailing list