From e0e3672f3ddfdc74b5c4131133f9eef5b7bd2dbb Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 30 Jan 2006 16:02:31 +0000 Subject: [PATCH] Added speed improvements git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2600 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/main.php | 5 ++++- .../departments/class_departmentManagement.inc | 3 +++ plugins/admin/groups/class_groupManagement.inc | 12 +++++++----- .../systems/class_selectUserToPrinterDialog.inc | 17 ++++++++++------- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/html/main.php b/html/main.php index 958d82641..dd02c0f7a 100644 --- a/html/main.php +++ b/html/main.php @@ -229,7 +229,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){ /* Load department list when plugin has changed. That is some kind of compromise between speed and beeing up to date */ if (isset($_GET['reset'])){ - $config->departments= get_departments(); + if (!isset($_SESSION['cached_departments'])){ + $_SESSION['cached_departments']= get_departments(); + } + $config->departments= $_SESSION['cached_departments']; $config->make_idepartments (); if (isset($_SESSION['objectinfo'])){ unset ($_SESSION['objectinfo']); diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 39c5eb93c..2a1e2e523 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -414,6 +414,9 @@ class departmentManagement extends plugin } natcasesort ($this->departments); reset ($this->departments); + + /* Unset global department list */ + unset($_SESSION['cached_departments']); } function remove_from_parent() diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 5ce272b32..84e7eda1e 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -492,11 +492,13 @@ class groupManagement extends plugin /* What are primary groups? */ $primaries= array(); $ldap= $this->config->get_ldap_link(); - $ldap->cd($base); - $ldap->search("(&(uid=$regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))", array("gidNumber", "cn")); - show_ldap_error($ldap->get_error()); - while ($attrs= $ldap->fetch()){ - $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0]; + if (!isset($this->config->data['MAIN']['NOPRIMARYGROUP'])){ + $ldap->cd($base); + $ldap->search("(&(uid=$regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))", array("gidNumber", "cn")); + show_ldap_error($ldap->get_error()); + while ($attrs= $ldap->fetch()){ + $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0]; + } } /* Set filter depending on selection */ diff --git a/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/plugins/admin/systems/class_selectUserToPrinterDialog.inc index 20ee7ea22..923f9454f 100644 --- a/plugins/admin/systems/class_selectUserToPrinterDialog.inc +++ b/plugins/admin/systems/class_selectUserToPrinterDialog.inc @@ -18,6 +18,7 @@ class selectUserToPrinterDialog extends plugin var $searchObjects = ""; var $searchAttrs = ""; var $searchAppend = ""; + var $baseAddition = ""; var $type = ""; function selectUserToPrinterDialog ($config, $dn= NULL,$type=false ) @@ -30,21 +31,25 @@ class selectUserToPrinterDialog extends plugin $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; $this->searchAttrs = array("cn","uid"); $this->searchAppend = "uid"; + $this->baseAddition = get_people_ou(); ;break; case "AddGroup" : $this->searchObjects = "(objectClass=posixGroup)"; $this->searchAttrs = array("cn","description"); $this->searchAppend = "cn"; + $this->baseAddition = get_groups_ou(); ;break; case "AddAdminUser" : $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; $this->searchAttrs = array("cn","uid"); $this->searchAppend = "uid"; + $this->baseAddition = get_people_ou(); ;break; case "AddAdminGroup" : $this->searchObjects = "(objectClass=posixGroup)"; $this->searchAttrs = array("cn","description"); $this->searchAppend = "cn"; + $this->baseAddition = get_groups_ou(); ;break; } $this->type = $type; @@ -70,11 +75,12 @@ class selectUserToPrinterDialog extends plugin $this->regex=preg_replace("/\*\*/","*",$this->regex); } + $tmp_printers= $this->getPrinter(); $smarty->assign("regexPrinter" , $this->regex); $smarty->assign("deplistPrinter" , $this->config->idepartments);//deplist); $smarty->assign("depselectPrinter" , $this->depselect); - $smarty->assign("gotoPrinters" , $this->getPrinter()); - $smarty->assign("gotoPrinterKeys" , array_flip($this->getPrinter())); + $smarty->assign("gotoPrinters" , $tmp_printers); + $smarty->assign("gotoPrinterKeys" , array_flip($tmp_printers)); $smarty->assign("apply" , apply_filter()); $smarty->assign("alphabet" , generate_alphabet()); $smarty->assign("search_image" , get_template_path('images/search.png')); @@ -115,7 +121,8 @@ class selectUserToPrinterDialog extends plugin $a_return=array(); $ldap = $this->config->get_ldap_link(); $ldap->cd($this->depselect); - $ldap->search("(&".$this->searchObjects."(cn=".$this->regex."))",$this->searchAttrs); + #$ldap->search("(&".$this->searchObjects."(cn=".$this->regex."))", $this->depselect, $this->searchAttrs); + $ldap->ls("(&".$this->searchObjects."(cn=".$this->regex."))", $this->baseAddition.$this->depselect, $this->searchAttrs); while($printer = $ldap->fetch()){ if(($detailed ==true)){ if(isset($printer[$this->searchAppend])){ @@ -135,9 +142,5 @@ class selectUserToPrinterDialog extends plugin } } - - - - // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2