Changeset 867 for trunk/Modules/Export
- Timestamp:
- Feb 6, 2016, 12:54:26 AM (9 years ago)
- Location:
- trunk/Modules/Export
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/ExportOutput.php
r864 r867 188 188 189 189 $Output = ''; 190 if(array_key_exists('Regenerate', $_POST)) 191 { 192 $System->Database->query('UPDATE ExportTask SET TimeStart = NOW(), `Progress`=0 , TimeFinish = NULL WHERE Export = '.$ExportId); 193 $Output .= ShowMessage('Soubor zařazen znovu ke zpracování do fronty.'); 194 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 195 } 196 197 $Output .= '<form action="?Action=View&Tab=7&ExportId='.$ExportId.'" method="post"><input type="submit" name="Regenerate" value="Přegenerovat"/></form><br />'; 198 $Output .= 'U DBC souborů export textů funguje jinak, protože generování je náročné, jsou požadavky zařazovány do fronty a postupně zpracovávány.<br />DBC soubory je nutné zabalit do souboru patch-enGB-5.MPQ uvnitř složky "DBFilesClient" a hru spouštět přes upravený spouštěcí soubor. Zabalit je můžete pomocí programu <a href="../download/mpqediten32.zip">Ladik\'s MPQ Editor</a>. Stav vygenerování můžete sledovat na této stránce.<br /><br />'; 199 200 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$ExportId); 190 $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId. 191 ') AND ((`TimeFinish` < `TimeStart`) OR (`TimeFinish` IS NULL))'); 201 192 if($DbResult->num_rows == 0) 202 193 { 203 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); 204 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 194 if(array_key_exists('Regenerate', $_POST)) 195 { 196 $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0 , `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId); 197 $Output .= ShowMessage('Soubor zařazen znovu ke zpracování do fronty.'); 198 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 199 } else { 200 $Output .= '<form action="?Action=View&Tab=7&ExportId='.$ExportId.'" method="post">'. 201 '<input type="submit" name="Regenerate" value="'.T('Regenerate').'"/></form><br />'; 202 } 203 } 204 205 $Output .= 'U DBC souborů export textů funguje jinak, protože generování je náročné, '. 206 'jsou požadavky zařazovány do fronty a postupně zpracovávány.<br />'. 207 'DBC soubory je nutné zabalit do souboru patch-enGB-5.MPQ uvnitř složky "DBFilesClient" a '. 208 'hru spouštět přes upravený spouštěcí soubor. Zabalit je můžete pomocí programu '. 209 '<a href="../download/mpqediten32.zip">Ladik\'s MPQ Editor</a>. Stav vygenerování '. 210 'můžete sledovat na této stránce.<br /><br />'; 211 212 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 213 if($DbResult->num_rows == 0) 214 { 215 $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeQueued` ) VALUES ('.$ExportId.', NOW())'); 216 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování DBC souboru', LOG_TYPE_DOWNLOAD); 205 217 $System->Database->query('UPDATE `ExportTask` SET `Progress`=0 WHERE `Export`='.$Export->Id); 206 218 } 207 219 208 $DbResult = $System->Database->query('SELECT *FROM `ExportTask` WHERE `Export` = '.$ExportId);220 $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId); 209 221 $ExportTask = $DbResult->fetch_assoc(); 210 if($ExportTask['TimeFinish'] > $ExportTask['TimeStart'])222 if($ExportTask['TimeFinish'] <> '') 211 223 { 212 224 $Output .= '<strong>Souhrný balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_DBC.zip').'">CzWoW_DBC.zip</a></strong><br/>'; … … 244 256 245 257 // Check if process task is running 258 $Timeout = 60 * 60 * 2; // two hours 246 259 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` '. 247 260 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` '. 248 261 'WHERE ((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 249 '(`TimeFinish` IS NULL) AND (`Time Start` < (NOW() - 10000))');262 '(`TimeFinish` IS NULL) AND (`TimeQueued` < (NOW() - '.$Timeout.'))'); 250 263 if($DbResult->num_rows > 0) 251 264 { … … 272 285 if(array_key_exists('Regenerate', $_POST)) 273 286 { 274 $System->Database->query('UPDATE `ExportTask` SET `Time Start` = NOW(), `Progress`=0, `TimeFinish` = NULL WHERE `Export` = '.$ExportId);287 $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0, `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId); 275 288 $Output .= ShowMessage('Soubor zařazen znovu ke zpracování do fronty.'); 276 289 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování exe souboru', LOG_TYPE_DOWNLOAD); 277 290 } else { 278 291 $Output .= '<form action="?Action=View&Tab=7&ExportId='.$ExportId.'" method="post">'. 279 '<input type="submit" name="Regenerate" value=" Přegenerovat"/></form><br />';292 '<input type="submit" name="Regenerate" value="'.T('Regenerate').'"/></form><br />'; 280 293 } 281 294 } … … 288 301 { 289 302 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); 290 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbcsouboru', LOG_TYPE_DOWNLOAD);291 } 292 293 $DbResult = $System->Database->query('SELECT *FROM `ExportTask` WHERE `Export` = '.$ExportId);303 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování DBC souboru', LOG_TYPE_DOWNLOAD); 304 } 305 306 $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId); 294 307 $ExportTask = $DbResult->fetch_assoc(); 295 if($ExportTask['TimeFinish'] > $ExportTask['TimeStart'])308 if($ExportTask['TimeFinish'] <> '') 296 309 { 297 310 $FileName = 'Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe'; -
trunk/Modules/Export/ProcessTask.php
r848 r867 50 50 { 51 51 //TMP="Z:\\a\\www\\wowpreklad\\tmp\\Export\\${EXPORTID}\\" 52 $patch = str_replace(DIRECTORY_SEPARATOR,'\\', $patch);52 $patch = str_replace(DIRECTORY_SEPARATOR,'\\', $patch); 53 53 $patch = 'Z:'.$patch; 54 54 return $patch; … … 97 97 { 98 98 // DBC files 99 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'. 100 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 9 AND `ExportTask`.`TimeFinish` IS NULL'); 99 $DbResult = $System->Database->query('SELECT `ExportTask`.`Id`, `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'. 100 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE (`Export`.`OutputType` = 9) '. 101 ' AND (`ExportTask`.`TimeFinish` IS NULL)'); 101 102 while($DbRow = $DbResult->fetch_assoc()) 102 103 { … … 106 107 try 107 108 { 109 $System->Database->update('ExportTask', '`Id`='.$DbRow['Id'], array('TimeStart' => 'NOW()')); 110 108 111 $Export = new Export($System); 109 112 $Export->Id = $DbRow['ExportId']; 110 113 $Export->Init(); 111 114 112 SetProgress($Export, 10);115 SetProgress($Export, 10); 113 116 114 117 echo('Mazání starých souborů...'."\n"); … … 118 121 if(file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip'); 119 122 120 SetProgress($Export, 20);123 SetProgress($Export, 20); 121 124 if(function_exists('gzcompress')) 122 125 { … … 125 128 exec('zip -r -j '.$Export->TempDir.'CzWoW_DBC.zip '.$Export->TempDir.'dbc/'); 126 129 echo('Hotovo'."\n"); 127 SetProgress($Export, 80);130 SetProgress($Export, 80); 128 131 } else echo('Funkce pro tvorbu Zip souboru není podporována!'."\n"); 129 132 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$Export->Id); … … 132 135 echo 'Caught exception: ', $e->getMessage(), "\n"; 133 136 } 134 SetProgress($Export, 100);137 SetProgress($Export, 100); 135 138 } else 136 139 { … … 140 143 } 141 144 142 //EXE files 143 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'. 144 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 10 AND `ExportTask`.`TimeFinish` IS NULL'); 145 // EXE files 146 $DbResult = $System->Database->query('SELECT `ExportTask`.`Id`, `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'. 147 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE (`Export`.`OutputType` = 10) '. 148 ' AND (`ExportTask`.`TimeFinish` IS NULL)'); 145 149 while($DbRow = $DbResult->fetch_assoc()) 146 150 { … … 150 154 try 151 155 { 156 $System->Database->update('ExportTask', '`Id`='.$DbRow['Id'], array('TimeStart' => 'NOW()')); 152 157 // echo shell_exec('"'.dirname(__FILE__).'./client_cz_export.sh" '.$DbRow['ExportId'].''); 153 158 … … 161 166 162 167 // Delete old files 163 SetProgress($Export, 1);168 SetProgress($Export, 1); 164 169 echo('Delete old files...'."\n"); 165 170 DeleteOldFiles($Export->TempDir.'dbc'); … … 168 173 169 174 //copy need files 170 SetProgress($Export, 5);175 SetProgress($Export, 5); 171 176 echo('Copy files...'."\n"); 172 177 rcopy('files/'.$Export->ClientVersion['Version'].'/patch-5.MPQ', $Export->TempDir.'patch-5.MPQ'); … … 177 182 rcopy('files/Fonts/', $Export->TempDir.'Fonts/'); 178 183 179 SetProgress($Export, 10);184 SetProgress($Export, 10); 180 185 echo('Export lua...'."\n"); 181 186 $Export->ExportToLua(); 182 SetProgress($Export, 15);187 SetProgress($Export, 15); 183 188 echo('Export CzWoW...'."\n"); 184 189 $Export->MakeAddon(); 185 SetProgress($Export, 30);190 SetProgress($Export, 30); 186 191 echo('Export dbc...'."\n"); 187 192 $Export->ExportToDBC(); 188 193 189 194 echo('Create readme...'."\n"); 190 SetProgress($Export, 60);195 SetProgress($Export, 60); 191 196 $File = new FileStream(); 192 197 $File->CreateFile($Export->TempDir.'ReadMe.htm'); … … 195 200 196 201 echo('Packing files...'."\n"); 197 SetProgress($Export, 70);198 $workdir = str_replace('/',DIRECTORY_SEPARATOR, $Export->TempDir);202 SetProgress($Export, 70); 203 $workdir = str_replace('/',DIRECTORY_SEPARATOR, $Export->TempDir); 199 204 MPQPack($workdir.'lua'); 200 SetProgress($Export, 80);205 SetProgress($Export, 80); 201 206 MPQPack($workdir.'dbc'); 202 207 203 SetProgress($Export, 90);208 SetProgress($Export, 90); 204 209 echo('Creating instalator...'."\n"); 205 210 if (DIRECTORY_SEPARATOR == '/') // linux … … 209 214 echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd 210 215 211 SetProgress($Export, 100);216 SetProgress($Export, 100); 212 217 echo ("\n"."Hotovo"."\n"); 213 218 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$DbRow['Export']); 214 219 } catch (Exception $e) 215 220 { 216 echo 'Caught exception: ', 221 echo 'Caught exception: ', $e->getMessage(), "\n"; 217 222 } 218 223 } else -
trunk/Modules/Export/cmdmpqexport.php
r848 r867 85 85 86 86 if(array_key_exists('needgeneration', $_GET)) { 87 $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` as Version, `Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,`Export`.`Description` FROM `Export` JOIN `ClientVersion` as `ClientVersion` ON `ClientVersion`.`Id`=`Export`.`ClientVersion` WHERE `Featured`=1 ORDER BY `ClientVersion`.`BuildNumber` DESC'); 87 $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` AS `Version`, '. 88 '`Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,'. 89 '`Export`.`Description` FROM `Export` '. 90 'JOIN `ClientVersion` AS `ClientVersion` ON `ClientVersion`.`Id`=`Export`.`ClientVersion` '. 91 'WHERE `Featured`=1 ORDER BY `ClientVersion`.`BuildNumber` DESC'); 88 92 while ($DbExport = $DbRows->fetch_assoc()) { 89 93 $Export = new Export($System); … … 91 95 $Output .= $Export->Init(); 92 96 if ($Export->NeedGeneration()) { 93 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export= '.$Export->Id);97 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$Export->Id); 94 98 if($DbResult->num_rows == 0) 95 99 { 96 $System->Database->query('INSERT INTO ExportTask(`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())');100 $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())'); 97 101 } else 98 $System->Database->query('UPDATE ExportTask SET `TimeStart` = NOW(), `Progress` = 0, `TimeFinish` = NULL WHERE Export= '.$Export->Id);102 $System->Database->query('UPDATE `ExportTask` SET `TimeStart` = NOW(), `Progress` = 0, `TimeFinish` = NULL WHERE `Export` = '.$Export->Id); 99 103 100 104 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD);
Note:
See TracChangeset
for help on using the changeset viewer.