Changeset 666 for trunk/Modules/Export
- Timestamp:
- Dec 24, 2013, 3:04:01 PM (11 years ago)
- Location:
- trunk/Modules/Export
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/ExportOutput.php
r663 r666 206 206 if($ExportTask['TimeFinish'] > $ExportTask['TimeStart']) 207 207 { 208 $Output .= '<strong>Souhrný balík: <a href="../tmp/Export/'.$ExportTask['Export'].'/CzWoW_DBC.zip">CzWoW_DBC.zip</a></strong><br/>';209 208 $Export = new Export($System); 210 209 $Export->Id = $ExportId; 211 210 $Export->Init(); 211 $Output .= '<strong>Souhrný balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_DBC.zip').'">CzWoW_DBC.zip</a></strong><br/>'; 212 212 $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`DBCFileName` != ""'); 213 213 while($Group = $DbResult->fetch_assoc()) 214 214 { 215 215 if(file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc')) 216 $Output .= '<a href="'.$ Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc">'.$Group['DBCFileName'].'.dbc</a><br/>';216 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'dbc/'.$Group['DBCFileName'].'.dbc').'">'.$Group['DBCFileName'].'.dbc</a><br/>'; 217 217 } 218 } else $Output .= '<strong>Soubor čeká na zpracování ve frontě.</strong><br/>'; 219 return($Output); 220 } 221 function OutputEXEToFile($ExportId) 222 { 223 global $System; 224 225 $Output = ''; 226 if(array_key_exists('Regenerate', $_POST)) 227 { 228 $System->Database->query('UPDATE ExportTask SET TimeStart = NOW(), TimeFinish = NULL WHERE Export = '.$ExportId); 229 $Output .= ShowMessage('Soubor zařazen znovu ke zpracování do fronty.'); 230 } 231 232 $Output .= '<form action="?Action=View&Tab=7&ExportId='.$ExportId.'" method="post"><input type="submit" name="Regenerate" value="Přegenerovat"/></form><br />'; 233 $Output .= 'U souhrné instalace češtiny funguje export textů jinak, protože generování je náročné, jsou požadavky zařazovány do fronty a postupně zpracovávány.<br />'; 234 235 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$ExportId); 236 if($DbResult->num_rows == 0) 237 { 238 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); 239 $this->System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 240 } 241 242 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 243 $ExportTask = $DbResult->fetch_assoc(); 244 if($ExportTask['TimeFinish'] > $ExportTask['TimeStart']) 245 { 246 $Export = new Export($System); 247 $Export->Id = $ExportId; 248 $Export->Init(); 249 $Export->LoadFilters(); 250 $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/>'; 251 218 252 } else $Output .= '<strong>Soubor čeká na zpracování ve frontě.</strong><br/>'; 219 253 return($Output); … … 265 299 else if($Type == 8) $Output = OutputLua($ExportId); 266 300 else if($Type == 9) $Output = OutputDBCToFile($ExportId); 301 else if($Type == 10) $Output = OutputEXEToFile($ExportId); 267 302 else $Output = ShowMessage('Nebyl vybrán žádný formát výstupu.', MESSAGE_CRITICAL); 268 303 return($Output); -
trunk/Modules/Export/ProcessTask.php
r558 r666 3 3 ini_set('memory_limit', '100M'); 4 4 5 include_once('../includes/global.php'); 6 include_once('../includes/zip.lib.php'); 5 include_once(dirname(__FILE__).'/../../includes/global.php'); 6 include_once(dirname(__FILE__).'/../../includes/zip.lib.php'); 7 7 8 include_once('Export.php'); 8 9 include_once('ExportOutput.php'); 9 10 10 11 //LoadCommandLineParameters(); 12 $System = new System(); 13 $System->DoNotShowPage = true; 14 $System->Run(); 11 15 12 16 while(1) 13 17 { 14 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask` LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `ExportTask`.`TimeFinish` IS NULL'); 18 //DBC files 19 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask` LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 9 AND `ExportTask`.`TimeFinish` IS NULL'); 15 20 while($DbRow = $DbResult->fetch_assoc()) 16 21 { … … 55 60 } 56 61 } 62 63 //EXE files 64 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask` LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 10 AND `ExportTask`.`TimeFinish` IS NULL'); 65 while($DbRow = $DbResult->fetch_assoc()) 66 { 67 echo(StrFTime("%d/%m/%Y %H:%M:%S", time()).': Generování EXE souboru pro export '.$DbRow['ExportId'].'.. '."\n"); 68 if($DbRow['ExportId'] != '') 69 { 70 echo shell_exec('"'.dirname(__FILE__).'./client_cz_export.sh" '.$DbRow['ExportId'].''); 71 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$DbRow['Export']); 72 } else 73 { 74 $System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$DbRow['Export']); 75 echo('Export '.$DbRow['Export'].' nenalezen. Jeho úloha smazána.'."\n"); 76 } 77 } 57 78 sleep($Config['ExportTaskProcessPeriod']); 58 79 }
Note:
See TracChangeset
for help on using the changeset viewer.