Example #1
0
 public function Compile($sTargetDir, $oP = null, $bUseSymbolicLinks = false)
 {
     $sFinalTargetDir = $sTargetDir;
     if ($bUseSymbolicLinks) {
         // Skip the creation of a temporary dictionary, not compatible with symbolic links
         $sTempTargetDir = $sFinalTargetDir;
     } else {
         // Create a temporary directory
         // Once the compilation is 100% successful, then move the results into the target directory
         $sTempTargetDir = tempnam(SetupUtils::GetTmpDir(), 'itop-');
         unlink($sTempTargetDir);
         // I need a directory, not a file...
         SetupUtils::builddir($sTempTargetDir);
         // Here is the directory
     }
     try {
         $this->DoCompile($sTempTargetDir, $sFinalTargetDir, $oP = null, $bUseSymbolicLinks);
     } catch (Exception $e) {
         if ($sTempTargetDir != $sFinalTargetDir) {
             // Cleanup the temporary directory
             SetupUtils::rrmdir($sTempTargetDir);
         }
         throw $e;
     }
     if ($sTempTargetDir != $sFinalTargetDir) {
         // Move the results to the target directory
         SetupUtils::movedir($sTempTargetDir, $sFinalTargetDir);
     }
 }