diff --git a/setup/applicationinstaller.class.inc.php b/setup/applicationinstaller.class.inc.php index dcf8c2a0c..1af6a3ebe 100644 --- a/setup/applicationinstaller.class.inc.php +++ b/setup/applicationinstaller.class.inc.php @@ -214,7 +214,7 @@ class ApplicationInstaller } } - self::DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sWorkspaceDir, $bUseSymbolicLinks); + self::DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sTargetEnvironment, $bUseSymbolicLinks); $aResult = array( 'status' => self::OK, @@ -424,7 +424,7 @@ class ApplicationInstaller } - protected static function DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sWorkspaceDir = '', $bUseSymbolicLinks = false) + protected static function DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sEnvironment, $bUseSymbolicLinks = false) { SetupPage::log_info("Compiling data model."); @@ -480,13 +480,11 @@ class ApplicationInstaller $oFactory->LoadModule($oModule); } } - if (strlen($sWorkspaceDir) > 0) + $sDeltaFile = APPROOT.'data/'.$sEnvironment.'.delta.xml'; + if (file_exists($sDeltaFile)) { - $oWorkspace = new MFWorkspace(APPROOT.$sWorkspaceDir); - if (file_exists($oWorkspace->GetWorkspacePath())) - { - $oFactory->LoadModule($oWorkspace); - } + $oDelta = new MFDeltaModule($sDeltaFile); + $oFactory->LoadModule($oDelta); } //$oFactory->Dump(); if ($oFactory->HasLoadErrors()) diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 487c399dd..0b6869d94 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -102,11 +102,14 @@ class MFCompiler $sModuleName = $oModule->GetName(); $sModuleVersion = $oModule->GetVersion(); - $sModuleRootDir = realpath($oModule->GetRootDir()); - $sRelativeDir = basename($sModuleRootDir); - - // Push the other module files - SetupUtils::copydir($sModuleRootDir, $sTargetDir.'/'.$sRelativeDir, $bUseSymbolicLinks); + $sModuleRootDir = $oModule->GetRootDir(); + if ($sModuleRootDir != '') + { + $sModuleRootDir = realpath($sModuleRootDir); + $sRelativeDir = basename($sModuleRootDir); + // Push the other module files + SetupUtils::copydir($sModuleRootDir, $sTargetDir.'/'.$sRelativeDir, $bUseSymbolicLinks); + } $sCompiledCode = ''; diff --git a/setup/modelfactory.class.inc.php b/setup/modelfactory.class.inc.php index 4300808c7..fb7847ed2 100644 --- a/setup/modelfactory.class.inc.php +++ b/setup/modelfactory.class.inc.php @@ -131,6 +131,45 @@ class MFModule } } + /** + * MFDeltaModule: an optional module, made of a single file + * @package ModelFactory + */ +class MFDeltaModule extends MFModule +{ + public function __construct($sDeltaFile) + { + $this->sId = 'datamodel-delta'; + + $this->sName = 'delta'; + $this->sVersion = '1.0'; + + $this->sRootDir = ''; + $this->sLabel = 'Additional Delta'; + $this->aDataModels = array($sDeltaFile); + } + + public function GetName() + { + return ''; // Objects created inside this pseudo module retain their original module's name + } + + public function GetRootDir() + { + return ''; + } + + public function GetModuleDir() + { + return ''; + } + + public function GetDictionaryFiles() + { + return array(); + } +} + /** * ModelFactory: the class that manages the in-memory representation of the XML MetaModel * @package ModelFactory diff --git a/setup/runtimeenv.class.inc.php b/setup/runtimeenv.class.inc.php index f5526dd81..8c6e2544f 100644 --- a/setup/runtimeenv.class.inc.php +++ b/setup/runtimeenv.class.inc.php @@ -35,6 +35,8 @@ define ('MODULE_ACTION_IMPOSSIBLE', 3); define ('ROOT_MODULE', '_Root_'); // Convention to store IN MEMORY the name/version of the root module i.e. application define ('DATAMODEL_MODULE', 'datamodel'); // Convention to store the version of the datamodel + + class RunTimeEnvironment { protected $sTargetEnv; @@ -313,6 +315,14 @@ class RunTimeEnvironment } } } + + $sDeltaFile = APPROOT.'data/'.$sSourceEnv.'.delta.xml'; + if (file_exists($sDeltaFile)) + { + $oDelta = new MFDeltaModule($sDeltaFile); + $aRet[] = $oDelta; + } + return $aRet; }