Changeset 867 for trunk/Modules/Export/ProcessTask.php
- Timestamp:
- Feb 6, 2016, 12:54:26 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.