Explorar o código

Added a detailed log of the compiler (temporary ? for debugging purposes ?)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2473 a333f486-631f-4898-b8df-5754b55c2be0
dflaven %!s(int64=12) %!d(string=hai) anos
pai
achega
5cb6f29a3d
Modificáronse 2 ficheiros con 21 adicións e 2 borrados
  1. 2 0
      setup/applicationinstaller.class.inc.php
  2. 19 2
      setup/compiler.class.inc.php

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

@@ -492,6 +492,8 @@ class ApplicationInstaller
 		{
 			$oMFCompiler = new MFCompiler($oFactory);
 			$oMFCompiler->Compile($sTargetPath, null, $bUseSymbolicLinks);
+			$aCompilerLog = $oMFCompiler->GetLog();
+			SetupPage::log_info(implode("\n", $aCompilerLog));
 			SetupPage::log_info("Data model successfully compiled to '$sTargetPath'.");
 		}
 		

+ 19 - 2
setup/compiler.class.inc.php

@@ -52,7 +52,12 @@ class MFCompiler
 			$oPage->p($sText);
 		}
 	}
-
+	
+	public function GetLog()
+	{
+		return $this->aLog;
+	}
+	
 	public function Compile($sTargetDir, $oP = null, $bUseSymbolicLinks = false)
 	{
 		$aAllClasses = array(); // flat list of classes
@@ -77,6 +82,7 @@ class MFCompiler
 		if ($oUserRightsNode)
 		{
 			$sUserRightsModule = $oUserRightsNode->getAttribute('_created_in');
+			$this->Log("User Rights module foud: $sUserRightsModule");
 		}
 
 		// List root classes
@@ -236,7 +242,18 @@ EOF;
  */
 
 EOF;
-				file_put_contents($sResultFile, $sFileHeader.$sCompiledCode);
+				$ret = file_put_contents($sResultFile, $sFileHeader.$sCompiledCode);
+				if ($ret === false)
+				{
+					$iLen = strlen($sFileHeader.$sCompiledCode);
+					$fFree = @disk_free_space(dirname($sResultFile));
+					$aErr = error_get_last();
+					throw new Exception("Failed to write '$sResultFile'. Last error: '{$aErr['message']}', content to write: $iLen bytes, available free space on disk: $fFree.");
+				}
+			}
+			else
+			{
+					$this->Log("Compilation of module $sModuleName in version $sModuleVersion produced not code at all. No file written.");
 			}
 			
 		}