From 587937f4bdac82a0f762db413e13eda078e9a405 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 7 Nov 2008 13:33:38 +0000 Subject: [PATCH] -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 --- gosa-core/include/class_userinfo.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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)); } -- 2.30.2