From e2c5c2f7f4340a8b2ea94dae85f65ac247d2c280 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 28 May 2010 07:46:20 +0000 Subject: [PATCH] Updated GOsa Version detection - I just saw 'GOsa gosa-core' as result for get_gosa_version while using a tagged version. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18783 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/functions.inc | 37 +++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index da98e1f39..5e53623da 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2183,18 +2183,37 @@ function validate($string) /*! \brief Evaluate the current GOsa version from the build in revision string */ function get_gosa_version() { - global $svn_revision, $svn_path; + global $svn_revision, $svn_path; - /* Extract informations */ - $revision= preg_replace('/^[^0-9]*([0-9]+)[^0-9]*$/', '\1', $svn_revision); + /* Extract informations */ + $revision= preg_replace('/^[^0-9]*([0-9]+)[^0-9]*$/', '\1', $svn_revision); + + // Extract the relevant part out of the svn url + $release= preg_replace('%^.*/gosa/(.*)/include/functions.inc.*$%', '\1', $svn_path); + + // Remove stuff which is not interesting + if(preg_match("/gosa-core/i", $release)) $release = preg_replace("/[\/]gosa-core/i","",$release); + + // A Tagged Version + if(preg_match("#/tags/#i", $svn_path)){ + $release = preg_replace("/tags[\/]*/i","",$release); + $release = preg_replace("/\//","",$release) ; + return (sprintf(_("GOsa %s"),$release)); + } + + // A Branched Version + if(preg_match("#/branches/#i", $svn_path)){ + $release = preg_replace("/branches[\/]*/i","",$release); + $release = preg_replace("/\//","",$release) ; + return (sprintf(_("GOsa %s snapshot (Rev %s)"),$release , bold($revision))); + } + + // The trunk version + if(preg_match("#/trunk/#i", $svn_path)){ + return (sprintf(_("GOsa development snapshot (Rev %s)"), bold($revision))); + } - /* Release or development? */ - if (preg_match('%/gosa/trunk/%', $svn_path)){ - return (sprintf(_("GOsa development snapshot (Rev %s)"), bold($revision))); - } else { - $release= preg_replace('%^.*/([^/]+)/include/functions.inc.*$%', '\1', $svn_path); return (sprintf(_("GOsa $release"), $revision)); - } } -- 2.30.2