From d23346e6020fddccbb2b6ae04b0370c5893987e2 Mon Sep 17 00:00:00 2001 From: psc Date: Fri, 13 Mar 2009 15:33:52 +0000 Subject: [PATCH] Optimize group listing: Only fetch the items that are needed to decide weither to show an application item or not, instead of fetching all items from the ldap, which takes a lot of time in larger environments. (Fixes performance problems where group listing might fail at all, because its runtime exceeds the max_execution_time, Trac #2232) git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13543 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/groups/class_divListGroup.inc | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/trunk/gosa-core/plugins/admin/groups/class_divListGroup.inc b/trunk/gosa-core/plugins/admin/groups/class_divListGroup.inc index 2ee9518e8..c53613cc0 100644 --- a/trunk/gosa-core/plugins/admin/groups/class_divListGroup.inc +++ b/trunk/gosa-core/plugins/admin/groups/class_divListGroup.inc @@ -205,21 +205,11 @@ class divListGroup extends MultiSelectWindow $ui = get_userinfo(); - /* Fetch all application menu entries - */ - $base = get_groups_ou().$this->selectedBase; $ldap = $this->config->get_ldap_link(); - $ldap->cd ($base); - $ldap->search("(objectClass=gotoMenuEntry)",array("dn")); - $configured_apps = array(); - while($entry = $ldap->fetch()){ - $dn = preg_replace("/^.*(cn=[^,]+,".preg_quote(get_groups_ou(), '/').")/","\\1",$entry['dn']); - $configured_apps[$dn] = $dn; - } // Test Every Entry and generate divlist Array foreach($groups as $key => $val){ - + /* Create action icons - copy & paste icons */ $acl = $ui->get_permissions($val['dn'],"groups/group"); $acl_all = $ui->has_complete_category_acls($val['dn'],"groups"); @@ -246,6 +236,20 @@ class divListGroup extends MultiSelectWindow $posix=$mail=$samba=$appl=$phone=$enviro=$empty; + /* Set ldap base to dn of this group */ + $ldap->cd ($val['dn']); + + /* Set ldap size limit to 1, because we only need one entry */ + $ldap->set_size_limit(1); + + /* Search for applications. */ + $ldap->search("(objectClass=gotoMenuEntry)",array("dn")); + $entry = $ldap->fetch(); + + if (isset($entry['dn'])) { + $appl = $applimg; + } + if(isset($val['objectClass'])){ if(in_array("posixGroup", $val['objectClass'])) $posix = $posiximg; if(in_array("gosaMailAccount", $val['objectClass'])) $mail = $mailimg; @@ -254,10 +258,6 @@ class divListGroup extends MultiSelectWindow if(in_array("gotoEnvironment", $val['objectClass'])) $enviro= $envimg; } - if(isset($configured_apps[$val['dn']])){ - $appl = $applimg; - } - $title = "title='".preg_replace('/ /', ' ', LDAP::fix($val['dn']))."'"; if(!isset($val['description'][0])){ -- 2.30.2