Code

Only start recursive copy if source dn exists
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 Jul 2006 11:29:28 +0000 (11:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 Jul 2006 11:29:28 +0000 (11:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4071 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiManagement.inc

index 7e4f4e50cdae96191642a8b48a40da75acd1aa0f..26542a1ae12b4e3c7aef3a17cf59835c89711960 100644 (file)
@@ -388,18 +388,23 @@ class faiManagement extends plugin
 
       /* Duplicate applications 
        */
-      $ldap->cd ($appdst);
-      $ldap->recursive_remove();
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true);
-
+      $ldap->cat($appsrc,array("dn")) ;
+      if($ldap->count()){
+        $ldap->cd ($appdst);
+        $ldap->recursive_remove();
+        $ldap->cd ($this->config->current['BASE']);
+        $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true);
+      }
+  
       /* Duplicate mime types 
        */
-      $ldap->cd ($appdst);
-      $ldap->recursive_remove();
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->copy_FAI_resource_recursive($mimesrc,$mimedst,$NewReleaseName,$type,true);
-
+      $ldap->cat($mimesrc,array("dn")) ;
+      if($ldap->count()){
+        $ldap->cd ($appdst);
+        $ldap->recursive_remove();
+        $ldap->cd ($this->config->current['BASE']);
+        $ldap->copy_FAI_resource_recursive($mimesrc,$mimedst,$NewReleaseName,$type,true);
+      }
 
       $attr = array();
       $attr['objectClass'] = array("organizationalUnit","FAIbranch");