Ignore:
Timestamp:
Feb 6, 2016, 12:54:26 AM (9 years ago)
Author:
chronos
Message:
  • Added: Export task TimeQueued time which is different to TimeStart time which is actual time when task was started to be processed.
  • Fixed: Updated also export of DBC files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/ProcessTask.php

    r848 r867  
    5050{
    5151  //TMP="Z:\\a\\www\\wowpreklad\\tmp\\Export\\${EXPORTID}\\"
    52   $patch = str_replace(DIRECTORY_SEPARATOR,'\\',$patch);
     52  $patch = str_replace(DIRECTORY_SEPARATOR,'\\', $patch);
    5353  $patch = 'Z:'.$patch;
    5454  return $patch;
     
    9797{
    9898  // 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)');
    101102  while($DbRow = $DbResult->fetch_assoc())
    102103  {
     
    106107      try
    107108      {
     109        $System->Database->update('ExportTask', '`Id`='.$DbRow['Id'], array('TimeStart' => 'NOW()'));
     110
    108111        $Export = new Export($System);
    109112        $Export->Id = $DbRow['ExportId'];
    110113        $Export->Init();
    111114
    112         SetProgress($Export,10);
     115        SetProgress($Export, 10);
    113116
    114117        echo('Mazání starých souborů...'."\n");
     
    118121        if(file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip');
    119122
    120         SetProgress($Export,20);
     123        SetProgress($Export, 20);
    121124        if(function_exists('gzcompress'))
    122125        {
     
    125128          exec('zip -r -j '.$Export->TempDir.'CzWoW_DBC.zip '.$Export->TempDir.'dbc/');
    126129          echo('Hotovo'."\n");
    127           SetProgress($Export,80);
     130          SetProgress($Export, 80);
    128131        } else echo('Funkce pro tvorbu Zip souboru není podporována!'."\n");
    129132        $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$Export->Id);
     
    132135        echo 'Caught exception: ',  $e->getMessage(), "\n";
    133136      }
    134       SetProgress($Export,100);
     137      SetProgress($Export, 100);
    135138    } else
    136139    {
     
    140143  }
    141144
    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)');
    145149  while($DbRow = $DbResult->fetch_assoc())
    146150  {
     
    150154      try
    151155      {
     156        $System->Database->update('ExportTask', '`Id`='.$DbRow['Id'], array('TimeStart' => 'NOW()'));
    152157     // echo shell_exec('"'.dirname(__FILE__).'./client_cz_export.sh" '.$DbRow['ExportId'].'');
    153158
     
    161166
    162167        // Delete old files
    163         SetProgress($Export,1);
     168        SetProgress($Export, 1);
    164169        echo('Delete old files...'."\n");
    165170        DeleteOldFiles($Export->TempDir.'dbc');
     
    168173
    169174        //copy need files
    170         SetProgress($Export,5);
     175        SetProgress($Export, 5);
    171176        echo('Copy files...'."\n");
    172177        rcopy('files/'.$Export->ClientVersion['Version'].'/patch-5.MPQ', $Export->TempDir.'patch-5.MPQ');
     
    177182        rcopy('files/Fonts/', $Export->TempDir.'Fonts/');
    178183
    179         SetProgress($Export,10);
     184        SetProgress($Export, 10);
    180185        echo('Export lua...'."\n");
    181186        $Export->ExportToLua();
    182         SetProgress($Export,15);
     187        SetProgress($Export, 15);
    183188        echo('Export CzWoW...'."\n");
    184189        $Export->MakeAddon();
    185         SetProgress($Export,30);
     190        SetProgress($Export, 30);
    186191        echo('Export dbc...'."\n");
    187192        $Export->ExportToDBC();
    188193
    189194        echo('Create readme...'."\n");
    190         SetProgress($Export,60);
     195        SetProgress($Export, 60);
    191196        $File = new FileStream();
    192197        $File->CreateFile($Export->TempDir.'ReadMe.htm');
     
    195200
    196201        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);
    199204        MPQPack($workdir.'lua');
    200         SetProgress($Export,80);
     205        SetProgress($Export, 80);
    201206        MPQPack($workdir.'dbc');
    202207
    203         SetProgress($Export,90);
     208        SetProgress($Export, 90);
    204209        echo('Creating instalator...'."\n");
    205210        if (DIRECTORY_SEPARATOR == '/') // linux
     
    209214          echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd
    210215
    211         SetProgress($Export,100);
     216        SetProgress($Export, 100);
    212217        echo ("\n"."Hotovo"."\n");
    213218        $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$DbRow['Export']);
    214219      } catch (Exception $e)
    215220      {
    216         echo 'Caught exception: ',  $e->getMessage(), "\n";
     221        echo 'Caught exception: ', $e->getMessage(), "\n";
    217222      }
    218223    } else
Note: See TracChangeset for help on using the changeset viewer.