From e451bf43d98d1d10e39b816135302620e3bc03a3 Mon Sep 17 00:00:00 2001 From: psc Date: Thu, 19 May 2011 14:05:59 +0000 Subject: [PATCH] Apply fix for #6900 Force FAIdebianRelease and FAIdebianSection to the defaults of the currently active release, even if LDAP values are different git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@20890 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiPackage.inc | 60 ++++++++++++++----- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc index 796b72da7..ece39a90a 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc @@ -115,6 +115,10 @@ class faiPackage extends plugin $this->direct_packages_add = TRUE; } + /* Force Release and Sections to the currently selected Defaults */ + $this->FAIdebianRelease = $this->getRelease(); + $this->FAIdebianSection = $this->getSections(); + /* Generate package list */ $this->list= $this->genPkgs(TRUE); } @@ -198,23 +202,9 @@ class faiPackage extends plugin if(!$this->is_account){ - /* Assemble release name */ - $release = $this->parent->parent->fai_release; - $tmp= preg_replace('/[,]*'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/', '', $release); - $tmp= preg_replace('/ou=/', '', $tmp); - $rev= array_reverse(split(',', $tmp)); - $this->FAIdebianRelease= "/"; - foreach ($rev as $part){ - $this->FAIdebianRelease.= "/$part"; - } - $this->FAIdebianRelease= preg_replace('#^[/]*#', '', $this->FAIdebianRelease); + $this->FAIdebianRelease = $this->getRelease(); - /* Assemble sections */ - $repos= $this->getServerInfos(); - if(isset($repos[$this->FAIdebianRelease])){ - $this->FAIdebianSection= $repos[$this->FAIdebianRelease]; - $this->FAIdebianSection= array_unique($this->FAIdebianSection); - } + $this->FAIdebianSection = $this->getSections(); /* Assign Repository settings*/ $this->is_account = true; @@ -868,6 +858,44 @@ class faiPackage extends plugin return($ret); } + /*! \brief Assemble release name + Returns the currently used Debian Release. + */ + function getRelease() + { + /* Assemble release name */ + if (isset($this->parent->parent->fai_release)) { + $release = $this->parent->parent->fai_release; + } else { + $release = $this->dn; + # Remove CN + $tmp = preg_replace('/cn='.$this->cn.',/', '', $release); + # Remove ou=packages + $release = preg_replace('/'.preg_quote(get_ou('faiPackageRDN'), '/').'/', '', $tmp); + } + $tmp= preg_replace('/[,]*'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/', '', $release); + $tmp= preg_replace('/ou=/', '', $tmp); + $rev= array_reverse(split(',', $tmp)); + $release = "/"; + foreach ($rev as $part){ + $release .= "/$part"; + } + return(preg_replace('#^[/]*#', '', $release)); + } + + /*! \brief Assemble sections + Returns the currently used Debian archive sections. + */ + function getSections() + { + $ret = array(); + $repos= $this->getServerInfos(); + if(isset($repos[$this->FAIdebianRelease])){ + $ret = $repos[$this->FAIdebianRelease]; + $ret = array_unique($ret); + } + return $ret; + } /*! \brief Used for copy & paste. Returns a HTML input mask, which allows to change the cn of this entry. -- 2.30.2