Changeset 811 for trunk/Modules/Export/ProcessTask.php
- Timestamp:
- May 28, 2014, 11:00:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/ProcessTask.php
r805 r811 6 6 include_once(dirname(__FILE__).'/../../includes/zip.lib.php'); 7 7 8 include_once('Export.php'); 9 include_once('ExportOutput.php'); 8 include_once('Export.php'); 9 include_once('ExportOutput.php'); 10 10 11 11 //LoadCommandLineParameters(); … … 25 25 { 26 26 $Dir = opendir($deldir.'/') ; 27 while(($File = readdir($Dir)) !== false) 27 while(($File = readdir($Dir)) !== false) 28 28 { 29 29 if(($File != '..') and ($File != '.') and (!is_dir("$File"))) unlink($deldir.'/'.$File); … … 38 38 if (file_exists($dst)) DeleteOldFiles($dst); 39 39 if (is_dir($src)) { 40 if (!file_exists($dst)) mkdir($dst, 0777, true); 40 if (!file_exists($dst)) mkdir($dst, 0777, true); 41 41 $files = scandir($src); 42 42 foreach ($files as $file) 43 if ($file != "." && $file != ".." and (!is_dir("$src/$file"))) rcopy("$src/$file", "$dst/$file"); 43 if ($file != "." && $file != ".." and (!is_dir("$src/$file"))) rcopy("$src/$file", "$dst/$file"); 44 44 } 45 45 else if (file_exists($src)) copy($src, $dst); … … 51 51 $patch = 'Z:'.$patch; 52 52 return $patch; 53 } 53 } 54 54 55 55 function MPQPack($packdir) { … … 58 58 { 59 59 $Dir = opendir($packdir.DIRECTORY_SEPARATOR) ; 60 while(($File = readdir($Dir)) !== false) 61 { 62 if(($File != '..') and ($File != '.')) { 60 while(($File = readdir($Dir)) !== false) 61 { 62 if(($File != '..') and ($File != '.')) { 63 63 $File = str_replace('/',DIRECTORY_SEPARATOR,$File); 64 64 $InDir = ''; … … 78 78 $InDir = 'Interface\\\\GlueXML\\\\'; 79 79 } 80 80 81 81 if (DIRECTORY_SEPARATOR == '/') // linux 82 82 echo exec('wine cmd /C mpq.exe "'.GetWinZPatch($packdir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR).'patch-5.MPQ" '.$InDir.basename($File).' "'.GetWinZPatch($packdir.DIRECTORY_SEPARATOR).$File.'" '); 83 83 84 84 if (DIRECTORY_SEPARATOR == '\\') // windows 85 85 echo exec('mpq.exe "'.$packdir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'patch-5.MPQ" '.$InDir.basename($File).' "'.$packdir.DIRECTORY_SEPARATOR.$File.'" '); 86 86 87 87 echo "\n"; 88 88 } … … 97 97 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'. 98 98 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 9 AND `ExportTask`.`TimeFinish` IS NULL'); 99 while($DbRow = $DbResult->fetch_assoc()) 99 while($DbRow = $DbResult->fetch_assoc()) 100 100 { 101 101 echo(StrFTime("%d/%m/%Y %H:%M:%S", time()).': Generování DBC souborů pro export '.$DbRow['ExportId'].'.. '."\n"); 102 if($DbRow['ExportId'] != '') 103 { 104 try 102 if($DbRow['ExportId'] != '') 103 { 104 try 105 105 { 106 106 $Export = new Export($System); … … 111 111 112 112 echo('Mazání starých souborů...'."\n"); 113 113 114 114 // Delete old files 115 115 DeleteOldFiles($Export->TempDir.'dbc'); … … 117 117 118 118 SetProgress($Export,20); 119 if(function_exists('gzcompress')) 119 if(function_exists('gzcompress')) 120 120 { 121 121 $Export->ExportToDBC(); … … 126 126 } else echo('Funkce pro tvorbu Zip souboru není podporována!'."\n"); 127 127 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$Export->Id); 128 } catch (Exception $e) 128 } catch (Exception $e) 129 129 { 130 130 echo 'Caught exception: ', $e->getMessage(), "\n"; … … 141 141 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'. 142 142 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 10 AND `ExportTask`.`TimeFinish` IS NULL'); 143 while($DbRow = $DbResult->fetch_assoc()) 143 while($DbRow = $DbResult->fetch_assoc()) 144 144 { 145 145 echo(StrFTime("%d/%m/%Y %H:%M:%S", time()).': Generování EXE souboru pro export '.$DbRow['ExportId'].'.. '."\n"); 146 if($DbRow['ExportId'] != '') 147 { 148 try 146 if($DbRow['ExportId'] != '') 147 { 148 try 149 149 { 150 150 // echo shell_exec('"'.dirname(__FILE__).'./client_cz_export.sh" '.$DbRow['ExportId'].''); … … 157 157 158 158 $nsifile = 'install.nsi'; 159 159 160 160 // Delete old files 161 161 SetProgress($Export,1); … … 164 164 DeleteOldFiles($Export->TempDir.'lua'); 165 165 DeleteOldFiles($Export->TempDir.'CzWoW'); 166 166 167 167 //copy need files 168 168 SetProgress($Export,5); … … 173 173 rcopy('files/'.$Export->ClientVersion['Version'].'/CzWoW/', $Export->TempDir.'CzWoW/'); 174 174 rcopy('files/WoW.ico', $Export->TempDir.'WoW.ico'); 175 rcopy('files/Fonts/', $Export->TempDir.'Fonts/'); 176 175 rcopy('files/Fonts/', $Export->TempDir.'Fonts/'); 176 177 177 SetProgress($Export,10); 178 178 echo('Export lua...'."\n"); … … 184 184 echo('Export dbc...'."\n"); 185 185 $Export->ExportToDBC(); 186 186 187 187 echo('Create readme...'."\n"); 188 188 SetProgress($Export,60); … … 191 191 $File->WriteLine($Export->GetReadme()); 192 192 unset($File); 193 193 194 194 echo('Packing files...'."\n"); 195 195 SetProgress($Export,70); … … 203 203 if (DIRECTORY_SEPARATOR == '/') // linux 204 204 echo exec('makensis '.$workdir.$nsifile); 205 205 206 206 if (DIRECTORY_SEPARATOR == '\\') // windows 207 echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd 207 echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd 208 208 209 209 SetProgress($Export,100); 210 210 echo ("\n"."Hotovo"."\n"); 211 211 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$DbRow['Export']); 212 } catch (Exception $e) 212 } catch (Exception $e) 213 213 { 214 214 echo 'Caught exception: ', $e->getMessage(), "\n";
Note:
See TracChangeset
for help on using the changeset viewer.