Changeset 731 for trunk/Modules/Export/ProcessTask.php
- Timestamp:
- Jan 8, 2014, 1:05:05 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/ProcessTask.php
r730 r731 17 17 $System->Run(); 18 18 19 function SetProgres($Export,$per) { 20 $File = new FileStream(); 21 $File->CreateFile($Export->TempDir.'progress'); 22 $File->WriteLine($per); 19 function SetProgress($Export,$per) { 20 global $System; 21 $System->Database->query('UPDATE `ExportTask` SET `Progress`='.$per.' WHERE `Export`='.$Export->Id); 23 22 } 24 23 function SetOnline() { … … 119 118 $Export->Init(); 120 119 121 SetProgres ($Export,10);120 SetProgress($Export,10); 122 121 123 122 echo('Mazání starých souborů...'."\n"); … … 127 126 if(file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip'); 128 127 129 SetProgres ($Export,20);128 SetProgress($Export,20); 130 129 if(function_exists('gzcompress')) 131 130 { … … 134 133 exec('zip -r -j '.$Export->TempDir.'CzWoW_DBC.zip '.$Export->TempDir.'dbc/'); 135 134 echo('Hotovo'."\n"); 136 SetProgres ($Export,80);135 SetProgress($Export,80); 137 136 } else echo('Funkce pro tvorbu Zip souboru není podporována!'."\n"); 138 137 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$Export->Id); … … 141 140 echo 'Caught exception: ', $e->getMessage(), "\n"; 142 141 } 143 if (file_exists($Export->TempDir.'progress')) unlink($Export->TempDir.'progress');144 142 } else 145 143 { … … 157 155 if($DbRow['ExportId'] != '') 158 156 { 157 try 158 { 159 159 // echo shell_exec('"'.dirname(__FILE__).'./client_cz_export.sh" '.$DbRow['ExportId'].''); 160 160 … … 168 168 169 169 // Delete old files 170 SetProgres ($Export,5);170 SetProgress($Export,5); 171 171 echo('Delete old files...'."\n"); 172 172 DeleteOldFiles($Export->TempDir.'dbc'); … … 175 175 176 176 //copy need files 177 SetProgres ($Export,10);177 SetProgress($Export,10); 178 178 echo('Copy files...'."\n"); 179 179 rcopy('files/'.$Export->ClientVersion['Version'].'/patch-5.MPQ', $Export->TempDir.'patch-5.MPQ'); … … 184 184 rcopy('files/Fonts/', $Export->TempDir.'Fonts/'); 185 185 186 SetProgres ($Export,15);186 SetProgress($Export,15); 187 187 echo('Export lua...'."\n"); 188 188 $Export->ExportToLua(); 189 SetProgres ($Export,20);189 SetProgress($Export,20); 190 190 echo('Export CzWoW...'."\n"); 191 191 $Export->MakeAddon(); 192 SetProgres ($Export,30);192 SetProgress($Export,35); 193 193 echo('Export dbc...'."\n"); 194 194 $Export->ExportToDBC(); 195 195 196 196 echo('Create readme...'."\n"); 197 SetProgres ($Export,60);197 SetProgress($Export,65); 198 198 $File = new FileStream(); 199 199 $File->CreateFile($Export->TempDir.'ReadMe.htm'); … … 202 202 203 203 echo('Packing files...'."\n"); 204 SetProgres ($Export,70);204 SetProgress($Export,70); 205 205 $workdir = str_replace('/',DIRECTORY_SEPARATOR,$Export->TempDir); 206 206 MPQPack($workdir.'lua'); 207 SetProgres ($Export,80);207 SetProgress($Export,80); 208 208 MPQPack($workdir.'dbc'); 209 209 210 SetProgres ($Export,90);210 SetProgress($Export,90); 211 211 echo('Creating instalator...'."\n"); 212 212 if (DIRECTORY_SEPARATOR == '/') // linux … … 216 216 echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd 217 217 218 SetProgres ($Export,100);218 SetProgress($Export,100); 219 219 echo ("\n"."Hotovo"."\n"); 220 220 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$DbRow['Export']); 221 } catch (Exception $e) 222 { 223 echo 'Caught exception: ', $e->getMessage(), "\n"; 224 } 221 225 } else 222 226 {
Note:
See TracChangeset
for help on using the changeset viewer.