summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0adb7b2)
raw | patch | inline | side by side (parent: 0adb7b2)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Jun 2008 11:18:16 +0000 (11:18 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Jun 2008 11:18:16 +0000 (11:18 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11295 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/setup/class_setupStep_Migrate.inc | patch | blob | history |
diff --git a/gosa-core/setup/class_setupStep_Migrate.inc b/gosa-core/setup/class_setupStep_Migrate.inc
index e5679fd5b26e905b2a629988ea0a2f2c626c8a60..d6b486930b911baa287c807874b143347d34bf98 100644 (file)
}
+ /*! \brief This function checks the given ldap for old style (gosa-2.5)
+ menu entries and will prepare a list of actions that are required
+ to migrate them to gosa-2.6.
+ All required actions and some readable informations are stored in
+ $this->menu.
+ */
function check_menus()
{
-
- $start = microtime(1);
-
/* Establish ldap connection
*/
$cv = $this->parent->captured_values;
return;
}
-
- $releases = array();
- while($attrs = $ldap->fetch()){
- if(preg_match("/,ou=fai,/",$attrs['dn']) && in_array("organizationalUnit",$attrs['objectClass'])){
- $tmp = split("\,",$attrs['dn']);
- $fai_base = preg_replace("/,ou=fai,.*$/","",$attrs['dn']);
- $releases[convert_department_dn($fai_base,$cv['base'])] = $attrs['dn'];
- }
- }
-
-
+ /* Create application -> parameter mapping, used later to detect
+ which configured parameter belongs to which application entry.
+ */
$amap= array();
$ldap->cd($cv['base']);
$ldap->search("(objectClass=gosaApplication)", array("cn", "gosaApplicationParameter"));
}
}
- /* Search for all groups */
+ /* Search for all groups that have an old style application menu configured.
+ */
+ $appgroups = array();
$ldap->cd($cv['base']);
$ldap->search("(&(objectClass=gosaApplicationGroup)(objectClass=posixGroup)(FAIrelease=*))",
array("gosaMemberApplication","gosaApplicationParameter","FAIrelease","objectClass","gosaUnitTag"));
- $appgroups = array();
/* Create readable prefix for "What will be done" infos
*/
}
}
- /* Create release dn part.
- eg. "sisa/1.0.0" => "ou=1.0.0,ou=siga,"
+ /* Create release container for each release/subrelease.
+ eg. "sisa/1.0.0":
+ . "ou=siga, ..."
+ . "ou=1.0.0,ou=siga, .."
*/
$release = "";
$r = $info['FAIrelease'][0];
$z = split("/",$r);
foreach($z as $part){
- if(empty($part)){
- echo __LINE__; exit();
- }else{
+ if(!empty($part)){
$release = "ou=".$part.",".$release;
/* Append release department information to "What will be done" info
}
$after .= $s_add."ou: $part\n";
- /* Appen release data to ldap actions
+ /* Append release data to ldap actions
*/
$d = array();
$d['objectClass'] = array("top","FAIbranch","organizationalUnit");
*/
$current .= $s_del."gosaMemberApplication: ".$info['gosaMemberApplication'][$i]."\n";
- /* Append ldap update action to remove the old menu entry
+ /* Append ldap update action to remove the old menu entry attributes
*/
unset($info['objectClass']['count']);
$d = array();
if(isset($info['FAIrelease'])){
$d['FAIrelease'] = array();
}
-
$d['objectClass'] = array_remove_entries(array("gosaApplicationGroup","FAIreleaseTag"),$info['objectClass']);
$data['MODIFY'][$info['dn']] = $d;
}
- /* Append missing menu entry to "What is done info"
+ /* Append missing menu entry for "What is done info".
*/
- if(empty($name)){
- echo __LINE__; exit();
- }else{
+ if(!empty($name)){
$after .= "\n";
$after .= $s_add."dn: cn=$name,$location_dn$release_dn\n";
$after .= $s_add."objectClass: gotoMenuEntry\n";
$after .= $s_add."cn: $name\n";
$after .= $s_add."gosaApplicationPriority: $priority\n";
- /* Create ldap entry
+ /* Create ldap entry
*/
$d= array();
$d['objectClass'] = array("gotoMenuEntry");
}
}
}
-
+
+ /* Updated todo list
+ */
$todo[] = array(
"DETAILS" => FALSE,
"DN" => $info['dn'],
"TODO" => $data
);
}
+
+ /* Remember checks.
+ */
$this->menu = $todo;
/* Check if we were able to query the ldap server
$this->checks['old_style_menus']['STATUS'] = TRUE;
$this->checks['old_style_menus']['STATUS_MSG']= _("Ok");
$this->checks['old_style_menus']['ERROR_MSG'] = "";
-
}
}
+
+ /*! \brief Handle posts for the menu_dialog
+ Ensure that checked checkboxes stay checked.
+ */
function check_menu_posts()
{
foreach($this->menu as $key => $menu){
}
}
+
+ /*! \brief This function updates old-style application menus to
+ valid 2.6 application menus.
+ All selected menus will be converted (DETAILS = TRUE).
+ The ldap actions collected by check_menus() will be executed.
+ */
function migrate_usb_menus()
{
$cv['tls']);
$ldap = new ldapMultiplexer($ldap_l);
-
- /* First detect all release names
- */
$ldap->cd($cv['base']);
+ /* Walk through menus and detect selected menu
+ */
foreach($this->menu as $key => $menu){
if($menu['DETAILS']) {
+ /* Excute all LDAP-ADD actions
+ */
$success = TRUE;
foreach($menu['TODO']['ADD'] as $dn => $data){
$ldap->cd($cv['base']);
$base = preg_replace("/^[^,]+,/","",$dn);
- if(!$ldap->dn_exists($base)){
- echo "FEHLER !!! ES FEHLT : ".$base."<br>";
- }elseif(!$ldap->dn_exists($dn)){
+ if(!$ldap->dn_exists($dn)){
$ldap->cd($dn);
$ldap->add($data);
if (!$ldap->success()){
}
}
+ /* Execute all LDAP-MODIFY actions
+ */
foreach($menu['TODO']['MODIFY'] as $dn => $data){
+ $ldap->cd($cv['base']);
if(!$ldap->dn_exists($dn)){
- echo "FEHLER !!! ES FEHLT : ".$dn."<br>";
- }else{
$ldap->cd($dn);
$ldap->modify($data);
if (!$ldap->success()){
}
}
}
+
+ /* If every action was successful, remove this entry from the list
+ */
if($success){
unset($this->menu[$key]);
}
}
}
+
+ /* Udpate migration status for application menus
+ */
$this->check_menus();
}
}