catches client registry exceptions
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 12 Oct 2015 15:24:53 +0000 (17:24 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 14 Oct 2015 10:26:09 +0000 (12:26 +0200)
* and adds some code improvements / comments

Change-Id: Iaf1f0da26cfd8137ded1fda2a58a9641e20b4bdc
Reviewed-on: http://gerrit.tine20.com/customers/2270
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Config.php
tine20/Tinebase/Config/Abstract.php

index 6f3dfcb..97bc948 100644 (file)
@@ -795,7 +795,6 @@ class Tinebase_Config extends Tinebase_Config_Abstract
     {
         // get all config names to be included in registry
         $clientProperties = new Tinebase_Config_Struct(array());
-        $filters = array();
         $userApplications = Tinebase_Core::getUser()->getApplications(TRUE);
         foreach ($userApplications as $application) {
             $config = Tinebase_Config_Abstract::factory($application->name);
@@ -807,15 +806,21 @@ class Tinebase_Config extends Tinebase_Config_Abstract
                     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ 
                         . ' ' . print_r($definition, TRUE));
                     
-                    if ((isset($definition['clientRegistryInclude']) || array_key_exists('clientRegistryInclude', $definition)) && $definition['clientRegistryInclude'] === TRUE) {
+                    if ((isset($definition['clientRegistryInclude']) || array_key_exists('clientRegistryInclude', $definition))
+                        && $definition['clientRegistryInclude'] === TRUE)
+                    {
                         // add definition here till we have a better place
-                        $configRegistryItem = new Tinebase_Config_Struct(array(
-                            'value'         => $config->{$name},
-                            'definition'    => new Tinebase_Config_Struct($definition),
-                        ));
-                        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ 
-                            . ' ' . print_r($configRegistryItem->toArray(), TRUE));
-                        $clientProperties[$application->name][$name] = $configRegistryItem;
+                        try {
+                            $configRegistryItem = new Tinebase_Config_Struct(array(
+                                'value' => $config->{$name},
+                                'definition' => new Tinebase_Config_Struct($definition),
+                            ));
+                            if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
+                                . ' ' . print_r($configRegistryItem->toArray(), TRUE));
+                            $clientProperties[$application->name][$name] = $configRegistryItem;
+                        } catch (Exception $e) {
+                            Tinebase_Exception::log($e);
+                        }
                     }
                 }
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
index 12b70aa..8dd5be9 100644 (file)
@@ -300,7 +300,7 @@ abstract class Tinebase_Config_Abstract
             self::$_configFileData = include('config.inc.php');
             
             if (self::$_configFileData === false) {
-                die('central configuration file config.inc.php not found in includepath: ' . get_include_path());
+                die('Central configuration file config.inc.php not found in includepath: ' . get_include_path() . "\n");
             }
             
             if (isset(self::$_configFileData['confdfolder'])) {
@@ -443,6 +443,8 @@ abstract class Tinebase_Config_Abstract
         $configFileData = $this->_getConfigFileData();
         
         // appName section overwrites global section in config file
+        // TODO: this needs improvement -> it is currently not allowed to have configs with the same names in
+        //       an Application and Tinebase as this leads to strange/unpredictable results here ...
         return (isset($configFileData[$this->_appName]) || array_key_exists($this->_appName, $configFileData)) && (isset($configFileData[$this->_appName][$_name]) || array_key_exists($_name, $configFileData[$this->_appName])) ? $configFileData[$this->_appName] :
               ((isset($configFileData[$_name]) || array_key_exists($_name, $configFileData)) ? $configFileData : NULL);
     }
@@ -612,7 +614,10 @@ abstract class Tinebase_Config_Abstract
             case self::TYPE_STRING:     return (string) $_rawData;
             case self::TYPE_FLOAT:      return (float) $_rawData;
             case self::TYPE_DATETIME:   return new DateTime($_rawData);
-            case self::TYPE_KEYFIELD:   return Tinebase_Config_KeyField::create($_rawData, (isset($definition['options']) || array_key_exists('options', $definition)) ? (array) $definition['options'] : array());
+            case self::TYPE_KEYFIELD:   return Tinebase_Config_KeyField::create(
+                $_rawData,
+                (isset($definition['options']) || array_key_exists('options', $definition)) ? (array) $definition['options'] : array()
+            );
             default:                    return is_array($_rawData) ? new Tinebase_Config_Struct($_rawData) : $_rawData;
         }
     }