Code

Apply follow-up patch for 1797 from mba
authorpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Jun 2010 15:12:18 +0000 (15:12 +0000)
committerpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Jun 2010 15:12:18 +0000 (15:12 +0000)
Avoid repeating LDAP queries on every log request

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@18874 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-core/include/class_log.inc

index ed93a631ce0f32a99f4ff83a39cabeff0aabea6e..045cca27f2838971828563a10909db4ce02c1ebf 100644 (file)
@@ -163,7 +163,8 @@ class log {
       $ui = get_userinfo();
       if (isset($config->current['HONOURUNITTAGS']) &&
                 preg_match('/true/i', $config->current['HONOURUNITTAGS']) &&
-                $ui->gosaUnitTag != '') { 
+                $ui->gosaUnitTag != '' &&
+                !isset($config->data['SERVERS']['LOGGING'][$server_name]['UNITTAG'])) { 
         $ldap = $this->config->get_ldap_link() ;
         $ldap->cd($this->config->current['BASE']);
         $ldap->search("(&(&(objectClass=gosaLogServer)(gosaUnitTag=$ui->gosaUnitTag)(cn=$server_name)))");
@@ -174,6 +175,11 @@ class log {
           unset($config->data['SERVERS']['LOGGING'][$server_name]);  
           $this->config = $config;
           continue;
+        } else {
+          /* Add gosaUnitTag to config for future reference
+           */
+          $config->data['SERVERS']['LOGGING'][$server_name]['UNITTAG'] = $ui->gosaUnitTag;
+          $this->config = $config;
         }
       }