From cbd21818622abc24bf2f9c124915fc930e144103 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Mon, 24 Jan 2022 14:16:41 +0100 Subject: [PATCH 1/6] dbtools report.php : compatibility with CLI + symlinks --- datamodels/2.x/combodo-db-tools/bin/report.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/datamodels/2.x/combodo-db-tools/bin/report.php b/datamodels/2.x/combodo-db-tools/bin/report.php index 2428ce779..fa59bee57 100644 --- a/datamodels/2.x/combodo-db-tools/bin/report.php +++ b/datamodels/2.x/combodo-db-tools/bin/report.php @@ -6,9 +6,10 @@ use Combodo\iTop\DBTools\Service\DBAnalyzerUtils; -@include_once('../approot.inc.php'); -@include_once('../../approot.inc.php'); -@include_once('../../../approot.inc.php'); +@require_once '../approot.inc.php'; +@require_once '../../approot.inc.php'; +@require_once '../../../approot.inc.php'; +@require_once '../../../../approot.inc.php'; require_once(APPROOT.'application/startup.inc.php'); From 1da52a8517bbfb6798b7ed9dd6875474d615b1f5 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Mon, 24 Jan 2022 14:21:50 +0100 Subject: [PATCH 2/6] Revert "dbtools report.php : compatibility with CLI + symlinks" Woops pushed by mistake, sorry :/ This reverts commit cbd21818622abc24bf2f9c124915fc930e144103. --- datamodels/2.x/combodo-db-tools/bin/report.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/datamodels/2.x/combodo-db-tools/bin/report.php b/datamodels/2.x/combodo-db-tools/bin/report.php index fa59bee57..2428ce779 100644 --- a/datamodels/2.x/combodo-db-tools/bin/report.php +++ b/datamodels/2.x/combodo-db-tools/bin/report.php @@ -6,10 +6,9 @@ use Combodo\iTop\DBTools\Service\DBAnalyzerUtils; -@require_once '../approot.inc.php'; -@require_once '../../approot.inc.php'; -@require_once '../../../approot.inc.php'; -@require_once '../../../../approot.inc.php'; +@include_once('../approot.inc.php'); +@include_once('../../approot.inc.php'); +@include_once('../../../approot.inc.php'); require_once(APPROOT.'application/startup.inc.php'); From aa66bec783c57d15c3d7e05c6c0634a3794223d1 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Mon, 24 Jan 2022 15:54:42 +0100 Subject: [PATCH 3/6] :bulb: Add comment for the timezone config parameter --- core/config.class.inc.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 243ff1c1d..5107d09d2 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -605,6 +605,13 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ), + /** + * The timezone is automatically set using this parameter in \utils::InitTimeZone + * This method is called almost everywhere, cause it's called in \MetaModel::LoadConfig and exec.php... but you might + * need to get it yourself ! + * + * @used-by utils::InitTimeZone() + */ 'timezone' => array( 'type' => 'string', 'description' => 'Timezone (reference: http://php.net/manual/en/timezones.php). If empty, it will be left unchanged and MUST be explicitly configured in PHP', From 477128ad5386ce634cfd2848767caa1c507277a9 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 26 Jan 2022 13:58:49 +0100 Subject: [PATCH 4/6] =?UTF-8?q?:bulb:=20N=C2=B04023=20More=20phpdoc=20on?= =?UTF-8?q?=20\DBObjectSearch::AddCondition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dbobjectsearch.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/dbobjectsearch.class.php b/core/dbobjectsearch.class.php index 9b57078a8..041e31e1a 100644 --- a/core/dbobjectsearch.class.php +++ b/core/dbobjectsearch.class.php @@ -416,6 +416,10 @@ class DBObjectSearch extends DBSearch * @param string $sFilterCode * @param mixed $value * @param string $sOpCode operator to use : 'IN', 'NOT IN', 'Contains',' Begins with', 'Finishes with', ... + * If no operator is specified then : + * * for id field we will use "=" + * * for other fields we will call the corresponding {@link AttributeDefinition::GetSmartConditionExpression} method impl + * to generate the expression * @param bool $bParseSearchString * * @throws \CoreException From 64e8aa5fee8219cca43e1e0c4a93e471c51e5dc6 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 26 Jan 2022 10:31:20 +0100 Subject: [PATCH 5/6] =?UTF-8?q?N=C2=B04714=20New=20ITOP=5FCORE=5FVERSION?= =?UTF-8?q?=20constant=20See=20following=20constants=20PHPDoc=20for=20info?= =?UTF-8?q?rmation=20:=20*=20core/config.class.inc.php=20ITOP=5FVERSION=20?= =?UTF-8?q?*=20core/config.class.inc.php=20ITOP=5FCORE=5FVERSION=20*=20set?= =?UTF-8?q?up/itopdesignformat.class.inc.php=20ITOP=5FDESIGN=5FLATEST=5FVE?= =?UTF-8?q?RSION?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/config.class.inc.php | 15 ++++++++++++--- setup/itopdesignformat.class.inc.php | 6 ++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 5107d09d2..41c756984 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -27,12 +27,21 @@ define('ITOP_APPLICATION_SHORT', 'iTop'); * Constant containing the application version * Warning: this might be different from iTop core version! * - * @see ITOP_DESIGN_LATEST_VERSION for iTop core version - * - * @used-by utils::GetItopPatchVersion + * @see ITOP_CORE_VERSION to get iTop core version */ define('ITOP_VERSION', '2.7.0-dev'); +/** + * Constant containing the iTop core version, whatever application was built + * + * Note that in iTop 3.0.0 we used {@see ITOP_DESIGN_LATEST_VERSION} to get core version. + * When releasing, both constants should be updated : see `.make/release/update-versions.php` for that ! + * + * @since 2.7.7 3.0.1 3.1.1 N°4714 constant creation + * @used-by utils::GetItopPatchVersion + */ +define('ITOP_CORE_VERSION', '2.7.7'); + define('ITOP_REVISION', 'svn'); define('ITOP_BUILD_DATE', '$WCNOW$'); define('ITOP_VERSION_FULL', ITOP_VERSION.'-'.ITOP_REVISION); diff --git a/setup/itopdesignformat.class.inc.php b/setup/itopdesignformat.class.inc.php index f588c8dd4..e0fbc84dd 100644 --- a/setup/itopdesignformat.class.inc.php +++ b/setup/itopdesignformat.class.inc.php @@ -20,9 +20,11 @@ /** * iTop Datamodel XML format version - * And also iTop core version * - * To test for iTop core version use this constant instead of {@link ITOP_VERSION} ! + * It was also used in iTop 3.0.0 to get iTop core version (instead of {@see ITOP_VERSION} which gives the application version). + * To address this need you should now use {@see ITOP_CORE_VERSION} + * + * @see ITOP_CORE_VERSION to get full iTop core version */ define('ITOP_DESIGN_LATEST_VERSION', '1.7'); From 9b6f7d94f4c7f1dbae511161bcad887142901695 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 26 Jan 2022 15:41:01 +0100 Subject: [PATCH 6/6] =?UTF-8?q?N=C2=B04714=20Handle=20ITOP=5FCORE=5FVERSIO?= =?UTF-8?q?N=20update=20in=20.make/release/update-versions.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .make/release/update-versions.php | 1 + .make/release/update.classes.inc.php | 34 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/.make/release/update-versions.php b/.make/release/update-versions.php index 0f1dcd24e..0bab8f82c 100644 --- a/.make/release/update-versions.php +++ b/.make/release/update-versions.php @@ -27,6 +27,7 @@ $aFilesUpdaters = array( new iTopVersionFileUpdater(), new CssVariablesFileUpdater(), new DatamodelsModulesFiles(), + new ConstantFileUpdater('ITOP_CORE_VERSION', 'core/config.class.inc.php'), ); if (count($argv) === 1) diff --git a/.make/release/update.classes.inc.php b/.make/release/update.classes.inc.php index 6e20ee0d7..6d4c30973 100644 --- a/.make/release/update.classes.inc.php +++ b/.make/release/update.classes.inc.php @@ -69,6 +69,40 @@ abstract class AbstractSingleFileVersionUpdater extends FileVersionUpdater } } +/** + * @since 2.7.7 3.0.1 3.1.0 N°4714 + */ +class ConstantFileUpdater extends AbstractSingleFileVersionUpdater { + /** @var string */ + private $sConstantName; + + /** + * @param $sConstantName constant to search, for example `ITOP_CORE_VERSION` + * @param $sFileToUpdate file containing constant definition + */ + public function __construct($sConstantName, $sFileToUpdate) + { + $this->sConstantName = $sConstantName; + parent::__construct($sFileToUpdate); + } + + /** + * @inheritDoc + */ + public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath) + { + $sConstantSearchPattern = <<sConstantName}', ?'[^']+'\);/ +REGEXP; + + return preg_replace( + $sConstantSearchPattern, + "define('{$this->sConstantName}', '{$sVersionLabel}');", + $sFileContent + ); + } +} + class iTopVersionFileUpdater extends AbstractSingleFileVersionUpdater { public function __construct()