adds in memory caching for model config methods
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 20 Jul 2017 15:45:00 +0000 (17:45 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 21 Jul 2017 06:16:38 +0000 (08:16 +0200)
... and removes verbose debug logging

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

index f5f2656..1b1f0e0 100644 (file)
@@ -38,7 +38,14 @@ abstract class Tinebase_Server_Abstract implements Tinebase_Server_Interface
      * @var boolean
      */
     protected $_supportsSessions = false;
-    
+
+    /**
+     * cache for modelconfig methods by frontend
+     *
+     * @var array
+     */
+    protected static $_modelConfigMethods = array();
+
     /**
      * 
      */
@@ -128,12 +135,15 @@ abstract class Tinebase_Server_Abstract implements Tinebase_Server_Interface
     /**
      * get default modelconfig methods
      *
+     * @param string $frontend
      * @return array of Zend_Server_Method_Definition
-     *
-     * // TODO add caching?
      */
     protected static function _getModelConfigMethods($frontend)
     {
+        if (array_key_exists($frontend, Tinebase_Server_Abstract::$_modelConfigMethods)) {
+            return Tinebase_Server_Abstract::$_modelConfigMethods[$frontend];
+        }
+
         // get all apps user has RUN right for
         try {
             $userApplications = Tinebase_Core::getUser() ? Tinebase_Core::getUser()->getApplications() : array();
@@ -186,9 +196,11 @@ abstract class Tinebase_Server_Abstract implements Tinebase_Server_Interface
             }
         }
 
-        if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
+        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
             . ' Got MC definitions: ' . print_r(array_keys($definitions), true));
 
+        Tinebase_Server_Abstract::$_modelConfigMethods[$frontend] = $definitions;
+
         return $definitions;
     }
 }