diff --git a/.make/release/update-versions.php b/.make/release/update-versions.php index 488131d4b..f6f7348c6 100644 --- a/.make/release/update-versions.php +++ b/.make/release/update-versions.php @@ -26,6 +26,7 @@ require_once (__DIR__.DIRECTORY_SEPARATOR.'update.classes.inc.php'); $aFilesUpdaters = array( new iTopVersionFileUpdater(), 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 d344455c0..3f6a7faa1 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() diff --git a/approot.inc.php b/approot.inc.php index 5f3ed96c4..6444593c1 100644 --- a/approot.inc.php +++ b/approot.inc.php @@ -5,9 +5,11 @@ define('APPCONF', APPROOT.'conf/'); /** * 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', '3.0'); diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 4df53dc4d..46f079eb9 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -27,13 +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', '3.0.1-dev'); -define('ITOP_VERSION_NAME', 'Fullmoon'); +/** + * 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', '3.0.1'); + define('ITOP_REVISION', 'svn'); define('ITOP_BUILD_DATE', '$WCNOW$'); define('ITOP_VERSION_FULL', ITOP_VERSION.'-'.ITOP_REVISION); @@ -618,6 +626,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' => [ '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', diff --git a/core/dbobjectsearch.class.php b/core/dbobjectsearch.class.php index e62d7c070..d698eddf2 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