mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
Fixed issues when adding/removing modules during the setup:
- When adding modules: the data model was not refreshed in the cache before attempting to load "structure" (or "sample") data - When removing a module: remaining (invalid) triggers were still used. SVN:trunk[1401]
This commit is contained in:
@@ -1203,13 +1203,11 @@ abstract class DBObject
|
||||
|
||||
// Activate any existing trigger
|
||||
$sClass = get_class($this);
|
||||
$oSet = new DBObjectSet(new DBObjectSearch('TriggerOnObjectCreate'));
|
||||
$sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectCreate AS t WHERE t.target_class IN ('$sClassList')"));
|
||||
while ($oTrigger = $oSet->Fetch())
|
||||
{
|
||||
if (MetaModel::IsParentClass($oTrigger->Get('target_class'), $sClass))
|
||||
{
|
||||
$oTrigger->DoActivate($this->ToArgs('this'));
|
||||
}
|
||||
$oTrigger->DoActivate($this->ToArgs('this'));
|
||||
}
|
||||
|
||||
return $this->m_iKey;
|
||||
|
||||
@@ -210,7 +210,8 @@ try
|
||||
throw(new Exception("File $sFileName does not exist"));
|
||||
}
|
||||
|
||||
$oDataLoader = new XMLDataLoader(TMP_CONFIG_FILE); // When called by the wizard, the final config is not yet there
|
||||
InitDataModel(TMP_CONFIG_FILE, false); // When called by the wizard, the final config is not yet there
|
||||
$oDataLoader = new XMLDataLoader();
|
||||
if ($sSessionStatus == 'start')
|
||||
{
|
||||
$oChange = MetaModel::NewObject("CMDBChange");
|
||||
|
||||
@@ -46,16 +46,12 @@ class XMLDataLoader
|
||||
protected $m_aWarnings;
|
||||
protected $m_iCountCreated;
|
||||
|
||||
public function __construct($sConfigFileName = null)
|
||||
public function __construct()
|
||||
{
|
||||
$this->m_aKeys = array();
|
||||
$this->m_aObjectsCache = array();
|
||||
$this->m_oChange = null;
|
||||
$this->m_sCacheFileName = KEYS_CACHE_FILE;
|
||||
if ($sConfigFileName != null)
|
||||
{
|
||||
$this->InitDataModel($sConfigFileName);
|
||||
}
|
||||
$this->LoadKeysCache();
|
||||
$this->m_bSessionActive = true;
|
||||
$this->m_aErrors = array();
|
||||
@@ -118,31 +114,7 @@ class XMLDataLoader
|
||||
$this->ClearKeysCache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the ORM (MetaModel)
|
||||
*/
|
||||
protected function InitDataModel($sConfigFileName)
|
||||
{
|
||||
require_once(APPROOT.'/core/log.class.inc.php');
|
||||
require_once(APPROOT.'/core/kpi.class.inc.php');
|
||||
require_once(APPROOT.'/core/coreexception.class.inc.php');
|
||||
require_once(APPROOT.'/core/dict.class.inc.php');
|
||||
require_once(APPROOT.'/core/attributedef.class.inc.php');
|
||||
require_once(APPROOT.'/core/filterdef.class.inc.php');
|
||||
require_once(APPROOT.'/core/stimulus.class.inc.php');
|
||||
require_once(APPROOT.'/core/MyHelpers.class.inc.php');
|
||||
require_once(APPROOT.'/core/expression.class.inc.php');
|
||||
require_once(APPROOT.'/core/cmdbsource.class.inc.php');
|
||||
require_once(APPROOT.'/core/sqlquery.class.inc.php');
|
||||
require_once(APPROOT.'/core/dbobject.class.php');
|
||||
require_once(APPROOT.'/core/dbobjectsearch.class.php');
|
||||
require_once(APPROOT.'/core/dbobjectset.class.php');
|
||||
require_once(APPROOT.'/application/cmdbabstract.class.inc.php');
|
||||
require_once(APPROOT.'/core/userrights.class.inc.php');
|
||||
MetaModel::Startup($sConfigFileName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stores the keys & object cache in a file
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user