Changeset 731 for trunk/Modules/Export
- Timestamp:
- Jan 8, 2014, 1:05:05 PM (11 years ago)
- Location:
- trunk/Modules/Export
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/CreateAddon.php
r695 r731 121 121 if($Column['AddonFileName'] != '') 122 122 { 123 $this->AddProgress(1); 123 124 if(!isset($CreatedFileListCount[$Column['AddonFileName']])) 124 125 $CreatedFileListCount[$Column['AddonFileName']] = 0; -
trunk/Modules/Export/Export.php
r729 r731 302 302 303 303 function AddProgress($add = 2) { 304 if (file_exists($this->TempDir.'progress')) { 305 $File = new FileStream(); 306 $File->OpenFile($this->TempDir.'progress'); 307 $Line = $File->ReadLine(); 308 309 $File = new FileStream(); 310 $File->CreateFile($this->TempDir.'progress'); 311 $Line+=$add; 312 $File->WriteLine($Line); 313 } 304 305 $DbResult = $this->System->Database->query('SELECT Progress FROM `ExportTask` WHERE `Export`='.$this->Id); 306 $Task = $DbResult->fetch_assoc(); 307 $per = $Task['Progress']+$add; 308 $this->System->Database->query('UPDATE `ExportTask` SET `Progress`='.$per.' WHERE `Export`='.$this->Id); 314 309 } 315 310 … … 411 406 if($Progress != $OldProgress) 412 407 { 413 if ( $Group['Id'] == 13) $this->AddProgress(0.01);408 if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01); 414 409 $Output .= $Progress."%\r"; 415 410 echo($Output); … … 436 431 while($Group = $DbResult->fetch_assoc()) 437 432 { 433 $this->AddProgress(1); 438 434 // $this->AddProgress(); 439 435 $Output .= $Group['Name'].'... '; -
trunk/Modules/Export/ExportOutput.php
r729 r731 194 194 $System->Database->query('UPDATE ExportTask SET TimeStart = NOW(), TimeFinish = NULL WHERE Export = '.$ExportId); 195 195 $Output .= ShowMessage('Soubor zařazen znovu ke zpracování do fronty.'); 196 if (file_exists($Export->TempDir.'progress')) unlink($Export->TempDir.'progress');197 196 } 198 197 … … 205 204 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); 206 205 $this->System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 206 $System->Database->query('UPDATE `ExportTask` SET `Progress`=0 WHERE `Export`='.$Export->Id); 207 207 } 208 208 … … 220 220 } else { 221 221 222 $Line = 0; 223 if (file_exists (dirname(__FILE__).'/../../'.$Export->TempDirRelative.'progress')) { 224 $File = new FileStream(); 225 $File->OpenFile(dirname(__FILE__).'/../../'.$Export->TempDirRelative.'progress'); 226 $Line = $File->ReadLine(); 227 } 222 223 $DbResult = $System->Database->query('SELECT Progress FROM `ExportTask` WHERE `Export`='.$Export->Id); 224 $Task = $DbResult->fetch_assoc(); 225 228 226 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 229 227 'setTimeout("parent.location.href=\''.$System->Link('/export/?Action=View&Tab=7&Auto&ExportId='.$Export->Id).'\'", 5000)'. 230 228 '</script>'; 231 $Output .= ' <strong>Dokončeno procent: '.ProgressBar(300, $ Line).'</strong>';232 if ($ Line== 0) $Output .= '<br/><br/><strong>Soubor čeká na zpracování ve frontě.</strong><br/>';229 $Output .= ' <strong>Dokončeno procent: '.ProgressBar(300, $Task['Progress']).'</strong>'; 230 if ($Task['Progress'] == 0) $Output .= '<br/><br/><strong>Soubor čeká na zpracování ve frontě.</strong><br/>'; 233 231 } 234 232 return($Output); … … 248 246 $System->Database->query('UPDATE ExportTask SET TimeStart = NOW(), TimeFinish = NULL WHERE Export = '.$ExportId); 249 247 $Output .= ShowMessage('Soubor zařazen znovu ke zpracování do fronty.'); 250 if (file_exists($Export->TempDir.'progress')) unlink($Export->TempDir.'progress');248 $System->Database->query('UPDATE `ExportTask` SET `Progress`=0 WHERE `Export`='.$Export->Id); 251 249 } 252 250 … … 265 263 if($ExportTask['TimeFinish'] > $ExportTask['TimeStart']) 266 264 { 267 // unlink($Export->TempDirRelative.'progress');268 265 $Output .= '<strong>Souhrný EXE balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe').'">Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe</a></strong><br/>'; 269 266 270 267 } else { 271 268 272 $Line = 0; 273 if (file_exists (dirname(__FILE__).'/../../'.$Export->TempDirRelative.'progress')) { 274 $File = new FileStream(); 275 $File->OpenFile(dirname(__FILE__).'/../../'.$Export->TempDirRelative.'progress'); 276 $Line = $File->ReadLine(); 277 } 269 $DbResult = $System->Database->query('SELECT Progress FROM `ExportTask` WHERE `Export`='.$Export->Id); 270 $Task = $DbResult->fetch_assoc(); 271 278 272 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 279 273 'setTimeout("parent.location.href=\''.$System->Link('/export/?Action=View&Tab=7&Auto&ExportId='.$Export->Id).'\'", 5000)'. 280 274 '</script>'; 281 $Output .= ' <strong>Dokončeno procent: '.ProgressBar(300, $ Line).'</strong>';282 if ($ Line== 0) $Output .= '<br/><br/><strong>Soubor čeká na zpracování ve frontě.</strong><br/>';275 $Output .= ' <strong>Dokončeno procent: '.ProgressBar(300, $Task['Progress']).'</strong>'; 276 if ($Task['Progress'] == 0) $Output .= '<br/><br/><strong>Soubor čeká na zpracování ve frontě.</strong><br/>'; 283 277 } 284 278 return($Output); -
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.