From e9052e61ccd3745db4f209f05940d59a1be8f425 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 12 May 2010 15:18:40 +0000 Subject: [PATCH] Updated migrate of userRDN git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18396 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_migrate_userRDN.inc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gosa-core/include/class_migrate_userRDN.inc b/gosa-core/include/class_migrate_userRDN.inc index 51e9694d5..7dc90db6f 100644 --- a/gosa-core/include/class_migrate_userRDN.inc +++ b/gosa-core/include/class_migrate_userRDN.inc @@ -27,7 +27,6 @@ class migrate_userRDN implements propertyMigration $targetValue = $this->property->getValue(TRUE); $dnMatch = ""; if(!empty($initialValue)){ - foreach(preg_split("/,/", $initialValue) as $rdnPart){ if(empty($rdnPart)) continue; list($namingAttrs, $container) = preg_split("/=/",$rdnPart,2); @@ -61,7 +60,7 @@ class migrate_userRDN implements propertyMigration $this->found['add'][$targetValue.$container] = array(); } if($dn != $dnTo){ - $this->found['move'][$dn] = $dnTo; + $this->found['move'][] = array('from' => $dn, 'to' => $dnTo); $found = TRUE; } } @@ -84,7 +83,7 @@ class migrate_userRDN implements propertyMigration $this->found['add'][$targetValue.$container] = array(); } if($dn != $dnTo){ - $this->found['move'][$dn] = $dnTo; + $this->found['move'][] = array('from' => $dn, 'to' => $dnTo); $found = TRUE; } } @@ -105,8 +104,10 @@ class migrate_userRDN implements propertyMigration if(count($this->found['move'])) { $str.= "

"._("Objects that will be moved")."

"; $str.="
";
-            foreach($this->found['move'] as $dn => $dnTo){
-                $str.= sprintf(_("Moving object '%s' to '%s'"), $dn, $dnTo)."
"; + foreach($this->found['move'] as $id => $data){ + $checked = (!isset($_POST['migrateNow'])) ? 'checked':''; + $str.= ""; + $str.= sprintf(_("Moving object '%s' to '%s'"), $data['from'], $data['to'])."
"; } $str.="
"; } @@ -127,8 +128,10 @@ class migrate_userRDN implements propertyMigration } // Now move the objects to the new traget - foreach($this->found['move'] as $from => $to){ - $ldap->rename_dn($from, $to); + foreach($this->found['move'] as $id => $data){ + if(isset($_POST["migrateEntry_{$id}"])){ + $ldap->rename_dn($data['from'], $data['to']); + } } $this->checkForIssues(); } -- 2.30.2