diff --git a/application/utils.inc.php b/application/utils.inc.php index 95e2ca029..2292b5a29 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -2814,15 +2814,30 @@ HTML; * Check if iTop is in a development environment (VCS vs build number) * * @return bool + * + * @since 2.6.0 method creation + * @since 3.0.0 add the `developer_mode.enabled` config parameter + * + * @use `developer_mode.enabled` config parameter + * @use ITOP_REVISION */ public static function IsDevelopmentEnvironment() { - if (! defined('ITOP_REVISION')) { + $oConfig = utils::GetConfig(); + $bIsDevEnvInConfig = $oConfig->Get('developer_mode.enabled'); + if ($bIsDevEnvInConfig === true) { + return true; + } + if ($bIsDevEnvInConfig === false) { + return false; + } + + if (!defined('ITOP_REVISION')) { //defensive behaviour: by default we are not in dev environment //can happen even in production (unattended install for example) or with exotic use of iTop return false; } - + return ITOP_REVISION === 'svn'; } diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 6ecb68e0f..4bb83ff80 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -1415,6 +1415,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => true, ], + 'developer_mode.enabled' => [ + 'type' => 'bool', + 'description' => 'If true then unlocks dev env functionalities, see \utils::IsDevelopmentEnvironment', + 'default' => null, + 'value' => null, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ], 'theme.enable_precompilation' => [ 'type' => 'bool', 'description' => 'If false, theme compilation will not use any precompiled file setup optimization.)',