mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Regresssion of iTop 2.3.0 beta: properly load the metamodel from the environment.
SVN:trunk[4287]
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// Copyright (C) 2010-2012 Combodo SARL
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* File to include to initialize the datamodel in memory
|
||||
*
|
||||
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||
* @copyright Copyright (C) 2010-2016 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@@ -46,6 +46,4 @@ else
|
||||
$_SESSION['itop_env'] = ITOP_DEFAULT_ENV;
|
||||
}
|
||||
$sConfigFile = APPCONF.$sEnv.'/'.ITOP_CONFIG_FILE;
|
||||
MetaModel::Startup($sConfigFile);
|
||||
|
||||
?>
|
||||
MetaModel::Startup($sConfigFile, false /* $bModelOnly */, true /* $bAllowCache */, false /* $bTraceSourceFiles */, $sEnv);
|
||||
@@ -108,6 +108,7 @@ abstract class MetaModel
|
||||
|
||||
private static $m_bTraceSourceFiles = false;
|
||||
private static $m_aClassToFile = array();
|
||||
protected static $m_sEnvironment = 'production';
|
||||
|
||||
public static function GetClassFiles()
|
||||
{
|
||||
@@ -305,7 +306,7 @@ abstract class MetaModel
|
||||
return self::GetClassIcon($sParentClass, $bImgTag, $sMoreStyles);
|
||||
}
|
||||
}
|
||||
$sIcon = str_replace('/modules/', '/env-'.utils::GetCurrentEnvironment().'/', $sIcon); // Support of pre-2.0 modules
|
||||
$sIcon = str_replace('/modules/', '/env-'.self::$m_sEnvironment.'/', $sIcon); // Support of pre-2.0 modules
|
||||
if ($bImgTag && ($sIcon != ''))
|
||||
{
|
||||
$sIcon = "<img src=\"$sIcon\" style=\"vertical-align:middle;$sMoreStyles\"/>";
|
||||
@@ -3487,6 +3488,7 @@ abstract class MetaModel
|
||||
{
|
||||
if (!self::HasTable($sClass)) continue;
|
||||
|
||||
|
||||
// Check that the table exists
|
||||
//
|
||||
$sTable = self::DBGetTable($sClass);
|
||||
@@ -4125,11 +4127,13 @@ abstract class MetaModel
|
||||
}
|
||||
}
|
||||
|
||||
public static function Startup($config, $bModelOnly = false, $bAllowCache = true, $bTraceSourceFiles = false)
|
||||
public static function Startup($config, $bModelOnly = false, $bAllowCache = true, $bTraceSourceFiles = false, $sEnvironment = 'production')
|
||||
{
|
||||
self::$m_sEnvironment = $sEnvironment;
|
||||
|
||||
if (!defined('MODULESROOT'))
|
||||
{
|
||||
define('MODULESROOT', APPROOT.'env-'.utils::GetCurrentEnvironment().'/');
|
||||
define('MODULESROOT', APPROOT.'env-'.self::$m_sEnvironment.'/');
|
||||
|
||||
self::$m_bTraceSourceFiles = $bTraceSourceFiles;
|
||||
|
||||
@@ -4226,7 +4230,7 @@ abstract class MetaModel
|
||||
{
|
||||
Dict::EnableCache($sAppIdentity);
|
||||
}
|
||||
require_once(APPROOT.'env-'.utils::GetCurrentEnvironment().'/dictionaries/languages.php');
|
||||
require_once(APPROOT.'env-'.self::$m_sEnvironment.'/dictionaries/languages.php');
|
||||
|
||||
// Set the default language...
|
||||
Dict::SetDefaultLanguage(self::$m_oConfig->GetDefaultLanguage());
|
||||
@@ -4236,7 +4240,7 @@ abstract class MetaModel
|
||||
require_once(APPROOT.'/application/cmdbabstract.class.inc.php');
|
||||
|
||||
require_once(APPROOT.'core/autoload.php');
|
||||
require_once(APPROOT.'env-'.utils::GetCurrentEnvironment().'/autoload.php');
|
||||
require_once(APPROOT.'env-'.self::$m_sEnvironment.'/autoload.php');
|
||||
|
||||
foreach (self::$m_oConfig->GetAddons() as $sModule => $sToInclude)
|
||||
{
|
||||
@@ -4359,7 +4363,7 @@ abstract class MetaModel
|
||||
|
||||
public static function GetEnvironmentId()
|
||||
{
|
||||
return md5(APPROOT).'-'.utils::GetCurrentEnvironment();
|
||||
return md5(APPROOT).'-'.self::$m_sEnvironment;
|
||||
}
|
||||
|
||||
protected static $m_aExtensionClasses = array();
|
||||
|
||||
@@ -103,7 +103,7 @@ class RunTimeEnvironment
|
||||
MetaModel::ResetCache(md5(APPROOT).'-'.$this->sTargetEnv);
|
||||
}
|
||||
|
||||
MetaModel::Startup($oConfig, $bModelOnly, $bUseCache);
|
||||
MetaModel::Startup($oConfig, $bModelOnly, $bUseCache, false /* $bTraceSourceFiles */, $this->sTargetEnv);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user