From: hickert Date: Fri, 21 May 2010 09:26:49 +0000 (+0000) Subject: Updated property handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9f6318becf23b35039198053fbd52d1c43f44b80;p=gosa.git Updated property handling -Request plInfo for plugin classes only once. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18611 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc index a196a2ab6..5051d21b6 100644 --- a/gosa-core/include/class_configRegistry.inc +++ b/gosa-core/include/class_configRegistry.inc @@ -13,9 +13,30 @@ class configRegistry{ // Excludes property values defined in ldap public $ignoreLdapProperties = FALSE; + // Contains all classes with plInfo + public $classesWithInfo = array(); + function __construct($config) { $this->config = &$config; + + // Detect classes that have a plInfo method + global $class_mapping; + foreach ($class_mapping as $cname => $path){ + $cmethods = get_class_methods($cname); + if (is_array($cmethods) && in_array_ics('plInfo',$cmethods)){ + + // Get plugin definitions + $def = call_user_func(array($cname, 'plInfo'));; + + // Register Post Events (postmodfiy,postcreate,postremove,checkhook) + if(count($def)){ + $this->classesWithInfo[$cname] = $def; + } + } + } + + // (Re)Load properties $this->reload(); } @@ -102,36 +123,29 @@ class configRegistry{ $this->status = 'finished'; } - global $class_mapping; - foreach ($class_mapping as $cname => $path){ - $cmethods = get_class_methods($cname); - if (is_array($cmethods) && in_array_ics('plInfo',$cmethods)){ - - // Get plugin definitions - $def = call_user_func(array($cname, 'plInfo'));; - - // Register Post Events (postmodfiy,postcreate,postremove,checkhook) - if(count($def)){ - - $name = $cname; - $name = (isset($def['plShortName'])) ? $def['plShortName'] : $cname; - $name = (isset($def['plDescription'])) ? $def['plDescription'] : $cname; - - $this->classToName[$cname] = $name; - $data = array('name' => 'postcreate','type' => 'command'); - $this->register($cname, $data); - $data = array('name' => 'postremove','type' => 'command'); - $this->register($cname, $data); - $data = array('name' => 'postmodify','type' => 'command'); - $this->register($cname, $data); - $data = array('name' => 'check', 'type' => 'command'); - $this->register($cname, $data); - } - - if(isset($def['plProperties'])){ - foreach($def['plProperties'] as $property){ - $this->register($cname, $property); - } + // Register plugin properties. + foreach ($this->classesWithInfo as $cname => $def){ + + // Detect class name + $name = $cname; + $name = (isset($def['plShortName'])) ? $def['plShortName'] : $cname; + $name = (isset($def['plDescription'])) ? $def['plDescription'] : $cname; + + // Register post events + $this->classToName[$cname] = $name; + $data = array('name' => 'postcreate','type' => 'command'); + $this->register($cname, $data); + $data = array('name' => 'postremove','type' => 'command'); + $this->register($cname, $data); + $data = array('name' => 'postmodify','type' => 'command'); + $this->register($cname, $data); + $data = array('name' => 'check', 'type' => 'command'); + $this->register($cname, $data); + + // Register properties + if(isset($def['plProperties'])){ + foreach($def['plProperties'] as $property){ + $this->register($cname, $property); } } }