From: hickert Date: Thu, 21 Apr 2011 08:27:48 +0000 (+0000) Subject: Updated removal of config items X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5bf658c96af5d23511fcced5741cef86dd130166;p=gosa.git Updated removal of config items git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20763 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index 862b096f0..d703db5c1 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -526,9 +526,8 @@ class newConfigManagement extends plugin // Is an config item. if($this->cfgItemMap[$item['type']] != 'root'){ - $release = preg_replace("/^.*\//","", $this->getReleasePath($item['path'])); + $release = $this->getReleasePart($item['path']); $path = $this->getItemPath($item['path']); - $rpc = $this->config->getRpcHandle(); $rpc->removeConfigItem($release, $path); if(!$rpc->success()){ @@ -538,7 +537,39 @@ class newConfigManagement extends plugin $this->dataModel->removeItem($item['path']); } }else{ - echo $item['type']." - are not handled yet!"; + + // Remove distribution + if($item['type'] == 'Distribution'){ + + $dist = $this->getDistributionPart($item['path']); + $rpc = $this->config->getRpcHandle(); + $rpc->removeDistribution($dist, array('recursive' => TRUE)); + echo "Removing distribution '{$dist}'"; + if(!$rpc->success()){ + msg_dialog::display(_("Error"), sprintf(_("Failed to remove the distribution: %s. Error was: %s"), + $dist, $rpc->get_error()), ERROR_DIALOG); + return(NULL); + }else{ + $this->dataModel->removeItem($item['path']); + } + }elseif($item['type'] == 'Release'){ + + // Remove release + $release = preg_replace("/^.*\//","", $this->getReleasePart($item['path'])); + $rpc = $this->config->getRpcHandle(); + $rpc->removeRelease($release, TRUE); + echo "Removing release '{$release}'"; + if(!$rpc->success()){ + msg_dialog::display(_("Error"), sprintf(_("Failed to remove the release: %s. Error was: %s"), + $release, $rpc->get_error()),ERROR_DIALOG); + return(NULL); + }else{ + $this->dataModel->removeItem($item['path']); + } + + }else{ + echo $item['type']." - are not handled yet!"; + } } } } @@ -652,6 +683,15 @@ class newConfigManagement extends plugin return(NULL); } + + /*! \brief Extracts the distribution-part out of a path. + * e.g. /root/debian/squeeze/test/module -> debian + */ + function getDistributionPart($fullPath) + { + return(trim(preg_replace("#^/root/#","", $this->getDistributionPath($fullPath)), '/')); + } + /*! \brief Extracts the release-part out of a path. * e.g. /root/debian/squeeze/test/module -> squeeze/test