瀏覽代碼

Instrumentation of the setup/compiler: dump the complete XML data model at the end of the installation.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4759 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 8 年之前
父節點
當前提交
4e67ead342
共有 2 個文件被更改,包括 21 次插入0 次删除
  1. 4 0
      setup/applicationinstaller.class.inc.php
  2. 17 0
      setup/runtimeenv.class.inc.php

+ 4 - 0
setup/applicationinstaller.class.inc.php

@@ -499,11 +499,15 @@ class ApplicationInstaller
 				$oFactory->LoadModule($oModule);
 			}
 		}
+		// Dump the "reference" model, just before loading any actual delta
+		$oFactory->SaveToFile(APPROOT.'data/datamodel-'.$sEnvironment.'.xml');
+		
 		$sDeltaFile = APPROOT.'data/'.$sEnvironment.'.delta.xml';
 		if (file_exists($sDeltaFile))
 		{
 			$oDelta = new MFDeltaModule($sDeltaFile);
 			$oFactory->LoadModule($oDelta);
+			$oFactory->SaveToFile(APPROOT.'data/datamodel-'.$sEnvironment.'-with-delta.xml');
 		}
 		//$oFactory->Dump();
 		if ($oFactory->HasLoadErrors())

+ 17 - 0
setup/runtimeenv.class.inc.php

@@ -431,6 +431,12 @@ class RunTimeEnvironment
 		$oFactory = new ModelFactory($sSourceDirFull);
 		foreach($this->GetMFModulesToCompile($sSourceEnv, $sSourceDir) as $oModule)
 		{
+			if ($oModule instanceof MFDeltaModule)
+			{
+				// Just before loading the delta, let's save an image of the datamodel
+				// in case there is no delta the operation will be done after the end of the loop
+				$oFactory->SaveToFile(APPROOT.'data/datamodel-'.$this->sTargetEnv.'.xml');
+			}
 			$sModule = $oModule->GetName();
 			$oFactory->LoadModule($oModule);
 			if ($oFactory->HasLoadErrors())
@@ -452,6 +458,17 @@ class RunTimeEnvironment
 		}
 		else
 		{
+			if ($oModule instanceof MFDeltaModule)
+			{
+				// A delta was loaded, let's save a second copy of the datamodel
+				$oFactory->SaveToFile(APPROOT.'data/datamodel-'.$this->sTargetEnv.'-with-delta.xml');
+			}
+			else
+			{
+				// No delta was loaded, let's save the datamodel now
+				$oFactory->SaveToFile(APPROOT.'data/datamodel-'.$this->sTargetEnv.'.xml');
+			}
+			
 			$sTargetDir = APPROOT.'env-'.$this->sTargetEnv;
 			self::MakeDirSafe($sTargetDir);
 			$oMFCompiler = new MFCompiler($oFactory);