From: hickert Date: Fri, 14 May 2010 09:57:54 +0000 (+0000) Subject: Added migration for faiBaseRDN X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=12fa5496d0ce27ca771d854efee58a657caaa4a9;p=gosa.git Added migration for faiBaseRDN git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18473 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/migration/class_migrateFaiRDN.inc b/gosa-plugins/fai/admin/fai/migration/class_migrateFaiRDN.inc index be91061ff..b49c357f2 100644 --- a/gosa-plugins/fai/admin/fai/migration/class_migrateFaiRDN.inc +++ b/gosa-plugins/fai/admin/fai/migration/class_migrateFaiRDN.inc @@ -17,6 +17,8 @@ class migrateFaiRDN extends migrateRDN implements propertyMigration protected $suffix = ""; protected $prefix = ""; + public $faiBaseRDN; + function __construct($config,$property) { $this->property = &$property; @@ -35,7 +37,9 @@ class migrateFaiRDN extends migrateRDN implements propertyMigration $initialValue = $this->prefix.$this->property->getValue().$this->suffix; $targetValue = $this->prefix.$this->property->getValue(TRUE).$this->suffix; - $prefix = $this->config->get_cfg_value('faiManagement','faiBaseRDN'); + $prefixProp = $this->config->configRegistry->getProperty('faiManagement','faiBaseRDN'); + $prefix = $prefixProp->getValue(); + $prefixNew = $prefixProp->getValue(TRUE); $dnMatch = ""; if(!empty($initialValue) || !empty($prefix)){ @@ -93,7 +97,7 @@ class migrateFaiRDN extends migrateRDN implements propertyMigration $name = substr($dn,0, (strlen($dn) - strlen($initialValue.$releaseRDN.$prefix.$basePart))); // Build new container name and check if it exists. - $newContainer = $targetValue.$releaseRDN.$prefix.$basePart; + $newContainer = $targetValue.$releaseRDN.$prefixNew.$basePart; if(!$ldap->dn_exists($newContainer)){ $this->found['add'][$newContainer] = array(); } diff --git a/gosa-plugins/fai/admin/fai/migration/class_migrate_faiBaseRDN.inc b/gosa-plugins/fai/admin/fai/migration/class_migrate_faiBaseRDN.inc index d1e748cff..86380dc89 100644 --- a/gosa-plugins/fai/admin/fai/migration/class_migrate_faiBaseRDN.inc +++ b/gosa-plugins/fai/admin/fai/migration/class_migrate_faiBaseRDN.inc @@ -2,5 +2,41 @@ class migrate_faiBaseRDN extends migrateFaiRDN implements propertyMigration { protected $filter = "(&(objectClass=nothing)%s)"; + + + + function checkForIssues() + { + + // Check every single property which is connected to this property. + $ret = array('add' => array(), 'move' => array()); + foreach(array( + 'faiScript'=> 'faiScriptRDN', + 'faiHook'=> 'faiHookRDN', + 'faiTemplate'=> 'faiTemplateRDN', + 'faiVariable'=> 'faiVariableRDN', + 'faiProfile'=> 'faiProfileRDN', + 'faiPartitionTable'=> 'faiPartitionRDN', + 'faiPackage'=> 'faiPackageRDN') as $class => $name){ + + if($this->config->configRegistry->propertyExists($class,$name)){ + $prop = $this->config->configRegistry->getProperty($class,$name); + if($prop->migrationRequired()){ + $migrator = $prop->getMigrationClass(); + if($migrator){ + $tmp = $migrator->getChanges(); + if(isset($tmp['add'])){ + $ret['add'] = array_merge($tmp['add'],$ret['add']); + } + if(isset($tmp['move'])){ + $ret['move'] = array_merge($tmp['move'],$ret['move']); + } + } + } + } + } + $this->found = $ret; + return(count($ret['add']) || count($ret['move'])); + } } ?>