summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0c47a23)
raw | patch | inline | side by side (parent: 0c47a23)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 21 Nov 2007 13:35:06 +0000 (13:35 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 21 Nov 2007 13:35:06 +0000 (13:35 +0000) |
Reduced queries to a single ldap search.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7846 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7846 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/systems/class_terminalService.inc b/plugins/admin/systems/class_terminalService.inc
index 881ec2b5ced03258dff77a11b02c004ed9f37038..ea2c8d7fe049ebe90180beb5ea89c7d21e0891eb 100644 (file)
/* Eventually colorize phones */
$ldap->cd($this->config->current['BASE']);
- foreach ($this->hardware_list as $cn => $desc){
- $ldap->search("(goFonHardware=$cn)", array('cn'));
- if ($ldap->count() > 0){
- $ldap->fetch();
- if ($ldap->getDN() != $this->dn){
- $this->used_hardware[$cn]= $ldap->getDN();
+ $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
+ while($attrs = $ldap->fetch()){
+ $cn = $attrs['goFonHardware'][0];
+ if(isset($this->hardware_list[$cn])){
+ $this->used_hardware[$cn]= $cn;
}
- }
}
$this->hardware_list["automatic"]= _("automatic");
diff --git a/plugins/admin/systems/class_workstationService.inc b/plugins/admin/systems/class_workstationService.inc
index 757f0b9338d98c7db5cf7d0cd0325c694e0c40c5..8bb55fb52dc1c3d36bf1e0b68979e55ffd355444 100644 (file)
/* Eventually colorize phones */
$ldap->cd($this->config->current['BASE']);
- foreach ($this->hardware_list as $cn => $desc){
- $ldap->search("(goFonHardware=$cn)", array('cn'));
- if ($ldap->count() > 0){
- $ldap->fetch();
- if ($ldap->getDN() != $this->dn){
- $this->used_hardware[$cn]= $ldap->getDN();
+ $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
+ while($attrs = $ldap->fetch()){
+ $cn = $attrs['goFonHardware'][0];
+ if(isset($this->hardware_list[$cn])){
+ $this->used_hardware[$cn]= $cn;
}
- }
}
if(preg_match("/\+/",$this->gotoXHsync)){
diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc
index 9aa3b1635cbe078817ebb4df34345bce4b9e1031..01abe960e7ba95efdc439762127a07f30c3ac5a8 100644 (file)
* so we must detect which phones are currently in use.
*/
$ldap->cd($this->config->current['BASE']);
- foreach ($this->hardware_list as $cn => $desc){
- $ldap->search("(goFonHardware=$cn)", array('cn'));
- if ($ldap->count() > 0){
- $ldap->fetch();
- if ($ldap->getDN() != $this->dn){
- $this->used_hardware[$cn]= $ldap->getDN();
+ $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
+ while($attrs = $ldap->fetch()){
+ $cn = $attrs['goFonHardware'][0];
+ if(isset($this->hardware_list[$cn])){
+ $this->used_hardware[$cn]= $cn;
}
- }
}
$this->hardware_list["automatic"]= _("automatic");
ksort($this->hardware_list);