Code

Udpated dns stuff.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 May 2008 10:06:01 +0000 (10:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 May 2008 10:06:01 +0000 (10:06 +0000)
-If a host is removed, its dns entry will be removed too.

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

plugins/admin/systems/class_termDNS.inc

index 252d990625785d8aed6e22230306bff37097b08f..10677515edbfa37ec1d7c9958e4502bbec2f9353 100644 (file)
@@ -343,20 +343,25 @@ class termDNS extends plugin
     return($display);
   }
 
+
   function remove_from_parent()
   {
-    /*
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->orig_dn);
-    $ldap->search("(&(objectClass=dNSZone)(zoneName=*)(!(relativeDomainName=@)))",array("relativeDomainName","zoneName"));
-    while($attr = $ldap->fetch()){  
-      $ldap->cd($attr['dn']);
-      $ldap->rmDir($attr['dn']);
-      show_ldap_error("Record:".$ldap->get_error(), _("Removing terminal from DNS object failed")); 
-    }
-    */
+    if($this->DNSinitially_was_account){
+      $ldap = $this->config->get_ldap_link();
+      $tmp = array();
+      $this->dnsEntry['exists'] = false;
+      $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
+
+      /* Delete dns */
+      foreach($tmp['del'] as $dn => $del){
+        $ldap->cd($dn);
+        $ldap->rmdir_recursive($dn);
+        show_ldap_error("Record:".$ldap->get_error(), _("Removing terminal from DNS object failed")); 
+      }
+    }
   }
 
+
   /* Save data to object */
   function save_object()
   {