From: hickert Date: Fri, 7 Nov 2008 13:33:38 +0000 (+0000) Subject: -Little performance improvement. class_userinfo.inc get_module_departments X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=587937f4bdac82a0f762db413e13eda078e9a405;p=gosa.git -Little performance improvement. class_userinfo.inc get_module_departments Do not spend too much time with in_array check the array index instead git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12968 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_userinfo.inc b/gosa-core/include/class_userinfo.inc index bec139e58..2b987ad1e 100644 --- a/gosa-core/include/class_userinfo.inc +++ b/gosa-core/include/class_userinfo.inc @@ -557,7 +557,7 @@ class userinfo $dn = preg_replace("/^[^,]+,/","",$dn); } if(isset($this->config->idepartments[$dn])){ - $deps[] = $dn; + $deps[$dn] = $dn; } } } @@ -565,7 +565,7 @@ class userinfo /* For all gosaDepartments */ foreach ($this->config->departments as $dn){ - if(in_array($dn,$deps)) continue; + if(isset($deps[$dn])) continue; $acl = ""; if(strpos($mod, '/')){ $acl.= $this->get_permissions($dn,$mod); @@ -573,14 +573,15 @@ class userinfo $acl.= $this->get_category_permissions($dn,$mod,TRUE); } if(!empty($acl)) { - $deps[] = $dn; + $deps[$dn] = $dn; } } $ACL_CACHE['MODULE_DEPARTMENTS'][$mod] = $deps; $res = array_merge($res,$deps); - } - return ($res); + } + + return (array_values($res)); }