N°4518 Add config parameter to set platform as dev env (#220)

developer_mode.enabled, default value null
If true or false then will be used by \utils::IsDevelopmentEnvironment as return value, in all other cases will follow previous behavior
This commit is contained in:
Pierre Goiffon
2021-07-12 09:27:36 +02:00
committed by GitHub
parent d960183403
commit 7b6ac202c6
2 changed files with 25 additions and 2 deletions

View File

@@ -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';
}