From 82ba53d40b3ca2ddfe0207622c4fb4b583fbf7b2 Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Thu, 16 Jul 2020 16:11:15 +0200 Subject: [PATCH] 3059 - Automatically set the documentation URLs --- application/utils.inc.php | 18 ++++++++++++++++++ core/config.class.inc.php | 2 +- setup/setuputils.class.inc.php | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/application/utils.inc.php b/application/utils.inc.php index 529dbe21b..6217f1afb 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -2088,6 +2088,24 @@ class utils return COMPILATION_TIMESTAMP; } + /** + * @return string eg : '2_7_0' + */ + public static function GetItopVersionWikiSyntax() + { + $sVersionShort = self::GetItopVersionShort(); + return str_replace('.', '_', $sVersionShort); + } + + /** + * @return string eg '2.7.0' if ITOP_VERSION is '2.7.0-dev' + */ + public static function GetItopVersionShort() + { + $aExplodedVersion = explode('-', ITOP_VERSION); + return $aExplodedVersion[0]; + } + /** * Check if the given class if configured as a high cardinality class. * diff --git a/core/config.class.inc.php b/core/config.class.inc.php index f6677e43e..de0df09a8 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -22,7 +22,7 @@ define('ITOP_APPLICATION', 'iTop'); define('ITOP_APPLICATION_SHORT', 'iTop'); -define('ITOP_VERSION', '2.7.0-dev'); +define('ITOP_VERSION', '2.7.0-dev'); // @see utils::GetItopVersionShort() and utils::GetItopVersionWikiSyntax() define('ITOP_REVISION', 'svn'); define('ITOP_BUILD_DATE', '$WCNOW$'); define('ITOP_VERSION_FULL', ITOP_VERSION.'-'.ITOP_REVISION); diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index 2b260890c..217c4f77d 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -916,7 +916,7 @@ class SetupUtils $oPage, $bIsItopInstall, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $bTlsEnabled, $sTlsCA, $sNewDBName = '' ) { - $sWikiVersion = '2_7_0'; + $sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0'; $sMysqlTlsWikiPageUrl = 'https://wiki.openitop.org/doku.php?id='.$sWikiVersion.':install:php_and_mysql_tls'; $oPage->add('');