Changeset 811 for trunk/Modules/Export


Ignore:
Timestamp:
May 28, 2014, 11:00:26 PM (10 years ago)
Author:
chronos
Message:
  • Added: Better handling of repeater false referrer links. Now use manual BlackList table for checking which IP source is blocked.
File:
1 edited

Legend:

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

    r805 r811  
    66include_once(dirname(__FILE__).'/../../includes/zip.lib.php');
    77
    8 include_once('Export.php');   
    9 include_once('ExportOutput.php');   
     8include_once('Export.php');
     9include_once('ExportOutput.php');
    1010
    1111//LoadCommandLineParameters();
     
    2525        {
    2626          $Dir = opendir($deldir.'/') ;
    27           while(($File = readdir($Dir)) !== false) 
     27          while(($File = readdir($Dir)) !== false)
    2828          {
    2929            if(($File != '..') and ($File != '.') and (!is_dir("$File"))) unlink($deldir.'/'.$File);
     
    3838  if (file_exists($dst)) DeleteOldFiles($dst);
    3939  if (is_dir($src)) {
    40     if (!file_exists($dst)) mkdir($dst, 0777, true); 
     40    if (!file_exists($dst)) mkdir($dst, 0777, true);
    4141    $files = scandir($src);
    4242    foreach ($files as $file)
    43     if ($file != "." && $file != ".." and (!is_dir("$src/$file"))) rcopy("$src/$file", "$dst/$file"); 
     43    if ($file != "." && $file != ".." and (!is_dir("$src/$file"))) rcopy("$src/$file", "$dst/$file");
    4444  }
    4545  else if (file_exists($src)) copy($src, $dst);
     
    5151  $patch = 'Z:'.$patch;
    5252  return $patch;
    53 }     
     53}
    5454
    5555function MPQPack($packdir) {
     
    5858  {
    5959    $Dir = opendir($packdir.DIRECTORY_SEPARATOR) ;
    60     while(($File = readdir($Dir)) !== false) 
    61     {
    62       if(($File != '..') and ($File != '.')) {           
     60    while(($File = readdir($Dir)) !== false)
     61    {
     62      if(($File != '..') and ($File != '.')) {
    6363        $File = str_replace('/',DIRECTORY_SEPARATOR,$File);
    6464        $InDir = '';
     
    7878            $InDir = 'Interface\\\\GlueXML\\\\';
    7979        }
    80        
     80
    8181        if (DIRECTORY_SEPARATOR == '/') // linux
    8282          echo exec('wine cmd /C mpq.exe "'.GetWinZPatch($packdir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR).'patch-5.MPQ" '.$InDir.basename($File).' "'.GetWinZPatch($packdir.DIRECTORY_SEPARATOR).$File.'" ');
    83  
     83
    8484        if (DIRECTORY_SEPARATOR == '\\') // windows
    8585          echo exec('mpq.exe "'.$packdir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'patch-5.MPQ" '.$InDir.basename($File).' "'.$packdir.DIRECTORY_SEPARATOR.$File.'" ');
    86  
     86
    8787        echo "\n";
    8888      }
     
    9797  $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'.
    9898    ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 9 AND `ExportTask`.`TimeFinish` IS NULL');
    99   while($DbRow = $DbResult->fetch_assoc()) 
     99  while($DbRow = $DbResult->fetch_assoc())
    100100  {
    101101    echo(StrFTime("%d/%m/%Y %H:%M:%S", time()).': Generování DBC souborů pro export '.$DbRow['ExportId'].'.. '."\n");
    102     if($DbRow['ExportId'] != '') 
    103     {     
    104       try 
     102    if($DbRow['ExportId'] != '')
     103    {
     104      try
    105105      {
    106106        $Export = new Export($System);
     
    111111
    112112        echo('Mazání starých souborů...'."\n");
    113        
     113
    114114        // Delete old files
    115115        DeleteOldFiles($Export->TempDir.'dbc');
     
    117117
    118118        SetProgress($Export,20);
    119         if(function_exists('gzcompress')) 
     119        if(function_exists('gzcompress'))
    120120        {
    121121          $Export->ExportToDBC();
     
    126126        } else echo('Funkce pro tvorbu Zip souboru není podporována!'."\n");
    127127        $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$Export->Id);
    128       } catch (Exception $e) 
     128      } catch (Exception $e)
    129129      {
    130130        echo 'Caught exception: ',  $e->getMessage(), "\n";
     
    141141  $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'.
    142142    ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 10 AND `ExportTask`.`TimeFinish` IS NULL');
    143   while($DbRow = $DbResult->fetch_assoc()) 
     143  while($DbRow = $DbResult->fetch_assoc())
    144144  {
    145145    echo(StrFTime("%d/%m/%Y %H:%M:%S", time()).': Generování EXE souboru pro export '.$DbRow['ExportId'].'.. '."\n");
    146     if($DbRow['ExportId'] != '') 
    147     {     
    148       try 
     146    if($DbRow['ExportId'] != '')
     147    {
     148      try
    149149      {
    150150     // echo shell_exec('"'.dirname(__FILE__).'./client_cz_export.sh" '.$DbRow['ExportId'].'');
     
    157157
    158158        $nsifile = 'install.nsi';
    159        
     159
    160160        // Delete old files
    161161        SetProgress($Export,1);
     
    164164        DeleteOldFiles($Export->TempDir.'lua');
    165165        DeleteOldFiles($Export->TempDir.'CzWoW');
    166        
     166
    167167        //copy need files
    168168        SetProgress($Export,5);
     
    173173        rcopy('files/'.$Export->ClientVersion['Version'].'/CzWoW/', $Export->TempDir.'CzWoW/');
    174174        rcopy('files/WoW.ico', $Export->TempDir.'WoW.ico');
    175         rcopy('files/Fonts/', $Export->TempDir.'Fonts/');       
    176              
     175        rcopy('files/Fonts/', $Export->TempDir.'Fonts/');
     176
    177177        SetProgress($Export,10);
    178178        echo('Export lua...'."\n");
     
    184184        echo('Export dbc...'."\n");
    185185        $Export->ExportToDBC();
    186      
     186
    187187        echo('Create readme...'."\n");
    188188        SetProgress($Export,60);
     
    191191        $File->WriteLine($Export->GetReadme());
    192192        unset($File);
    193        
     193
    194194        echo('Packing files...'."\n");
    195195        SetProgress($Export,70);
     
    203203        if (DIRECTORY_SEPARATOR == '/') // linux
    204204          echo exec('makensis '.$workdir.$nsifile);
    205  
     205
    206206        if (DIRECTORY_SEPARATOR == '\\') // windows
    207           echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd 
     207          echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd
    208208
    209209        SetProgress($Export,100);
    210210        echo ("\n"."Hotovo"."\n");
    211211        $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$DbRow['Export']);
    212       } catch (Exception $e) 
     212      } catch (Exception $e)
    213213      {
    214214        echo 'Caught exception: ',  $e->getMessage(), "\n";
Note: See TracChangeset for help on using the changeset viewer.