Changeset 681


Ignore:
Timestamp:
Jan 1, 2014, 2:40:05 PM (11 years ago)
Author:
maron
Message:
  • Added: Setting for generation in cmd
  • Fixed: import old Version
Location:
trunk
Files:
4 edited

Legend:

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

    r677 r681  
    101101
    102102    return($Query);
     103  }
     104 
     105  function NeedGeneration()
     106  {
     107    $this->LoadFilters();
     108    if ($this->Export['OutputType'] == 10) $file = $this->TempDir.'Instalace_CzechWoW_'.$this->ClientVersion['Version'].'.exe';
     109    if ($this->Export['OutputType'] == 9) $file = $this->TempDir.'CzWoW_DBC.zip';
     110
     111    if (file_exists($file))
     112      $date = date('Y-m-d H:i',(filemtime($file)));
     113    else return(true);
     114  // echo $file;
     115   
     116    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
     117        'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
     118    $result = false;         
     119    while($Group = $DbResult->fetch_assoc())
     120    {
     121      $Query = 'SELECT * FROM `'.$Group['TablePrefix'].'` AS `T`'.
     122      ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '.
     123      ' JOIN `User` ON `User`.`ID`=`T`.`User`'.
     124      ' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$this->Id.')'.
     125      ' WHERE ( \''.$date.'\' < `T`.`ModifyTime`) AND (`Complete` = 1) AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')'.
     126      ' ';
     127
     128        $DbResult2 = $this->Database->query($Query);
     129        if ($DbResult2->num_rows > 0) {
     130          $result = true;
     131        } 
     132    } 
     133    return($result);
    103134  }
    104135 
  • trunk/Modules/Export/cmdmpqexport.php

    r669 r681  
    3636  }
    3737}
    38 if(!array_key_exists('ExportId', $_GET) and !array_key_exists('version', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) {
     38if(!array_key_exists('ExportId', $_GET) and !array_key_exists('needgeneration', $_GET) and !array_key_exists('version', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) {
    3939  $Output .= 'Usage type_export=id_export -for export<br />';
    4040  $Output .= 'Usage ExportId=id_export - for write export info<br />';
     41  $Output .= 'Usage needgeneration=id_export - for write export info<br />';
    4142 
    4243  $Output .= 'type_export={lua,dbc,addon} <br />';
     
    8687}
    8788
     89if(array_key_exists('needgeneration', $_GET)) {
     90  $Export = new Export($System);
     91  $Export->Id = $_GET['needgeneration'];
     92  $Output .= $Export->Init();                   
     93  if ($Export->NeedGeneration()) {
     94    $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$Export->Id);
     95    if($DbResult->num_rows == 0)
     96    {
     97      $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())');
     98    } else 
     99      $System->Database->query('UPDATE ExportTask SET TimeStart = NOW(), TimeFinish = NULL WHERE Export = '.$Export->Id);
     100
     101    $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD);
     102    $Output .= 'Export set to generation';
     103  } else     $Output .= 'Export do not need generation';
     104  $Output = str_replace('<br/>','
     105',$Output);
     106  $Output = str_replace('<br />','
     107',$Output);
     108}
     109
    88110if(array_key_exists('ExportId', $_GET)) {
    89111  $Export = new Export($System);
     
    127149'<h2>Nejčastější otázky</h2>'.
    128150'<p><strong>Jak mám hru spustit?</strong><br>'.
    129 'Hru musíte spustit přes soubor WoWLua.exe v kořenovém adresáři hry.</p>'.
     151'Hru musíte spustit přes soubor WowCz.exe v kořenovém adresáři hry.</p>'.
    130152
    131153'<p><strong>Mohu použít tuto češtinu na oficiálních serverech?</strong><br>'.
  • trunk/Modules/Import/Import.php

    r680 r681  
    4646  function InsertItem($Value)
    4747  {   
    48  
     48    $insert = true;
    4949    $Columns = '';
    5050    //$Values = '';
     
    5959    //print_r($Value);
    6060   
    61     $DbResultBefore = $this->System->Database->query('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionEnd` >'. $this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1');
    62     $DbResultAfter  = $this->System->Database->query('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` <'. $this->Version['BuildNumber'].' ORDER BY `VersionStart` LIMIT 1');
     61    $DbResultMiddle = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` <= '.$this->Version['BuildNumber'].' AND `VersionEnd` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1');
     62    $DbResultBefore = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionEnd` <= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1');
     63    $DbResultAfter  = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionStart` LIMIT 1');
    6364    //echo('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1');
    64     if(($DbResultBefore->num_rows > 0) or ($DbResultAfter->num_rows > 0))
     65    if(($DbResultMiddle->num_rows > 0) or ($DbResultBefore->num_rows > 0) or ($DbResultAfter->num_rows > 0))
    6566    {
    6667      // Update existed text
     68      $DbRowMiddle = $DbResultMiddle->fetch_assoc();
    6769      $DbRowAfter = $DbResultAfter->fetch_assoc();
    6870      $DbRowBefore = $DbResultBefore->fetch_assoc();
    69       if ($DbRowAfter['ID'] == $DbRowBefore['ID']) echo('` ');
    70       else
     71     
    7172      if($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) )
    7273      {
    73         if($DbRowBefore['VersionEnd'] <> $this->Version['BuildNumber'])
    74         {
     74        $insert = false;
     75          //echo ();
    7576          $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionEnd` = "'.$this->Version['BuildNumber'].'" WHERE `ID`='.$DbRowBefore['ID']);
    76           echo(', ');
    77         } else echo('. ');
     77          echo('b ');
     78       
    7879      } else
    7980      if($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0))
    8081      {
    81         if($DbRowAfter['VersionEnd'] <> $this->Version['BuildNumber'])
    82         {
     82        $insert = false;
    8383          $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionStart` = "'.$this->Version['BuildNumber'].'" WHERE `ID`='.$DbRowAfter['ID']);
    84           echo(', ');
    85         } else echo('. ');
     84          echo('a ');
     85       
    8686      } else
    8787      {
    88         $inserted = false;
    89         if (isset($DbRowAfter['VersionStart']))
    90           if ($DbRowAfter['VersionStart'] == $this->Version['BuildNumber']) {
     88       
     89        if (isset($DbRowAfter['VersionStart'])) {
     90          if ($DbRowAfter['VersionStart'] <= $this->Version['BuildNumber']) {
    9191            echo('Allready imported '.$DbRowBefore['Entry'].' ');
    92             $inserted = true;
    93           }
    94  
    95         if (isset($DbRowBefore['VersionEnd']))
    96           if ($DbRowBefore['VersionEnd'] == $this->Version['BuildNumber']) {
     92            $insert = false;
     93          }
     94        }
     95        if (isset($DbRowBefore['VersionEnd'])) {
     96          if ($DbRowBefore['VersionEnd'] >= $this->Version['BuildNumber']) {
    9797            echo('Allready imported '.$DbRowBefore['Entry'].' ');
    98             $inserted = true;
    99           }
    100        
    101         if (!$inserted)
     98            $inserted = false;
     99          }
     100        }       
     101       
     102            //if [DEPRECATED] do not import
     103        foreach($this->Group['Items'] as $GroupItem) {
     104          if (false !== strpos($Value[$GroupItem['Column']],'[DEPRECATED'))   
     105            $insert = false;
     106        }   
     107
     108       
     109        if (isset($DbRowMiddle['Entry'])) $insert = false;
     110        if (isset($DbRowAfter['Entry'])) $Value['Entry'] = $DbRowAfter['Entry'];
     111        if (isset($DbRowBefore['Entry'])) $Value['Entry'] = $DbRowBefore['Entry'];
     112
     113        if ($insert)
    102114        {     
     115         
    103116          $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
    104117          $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber'];
     
    109122          }
    110123          $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
     124     
     125      echo '
     126      '.$Value['Entry'].' = '.$DbRowBefore['VersionStart'].'.'.$DbRowBefore['VersionEnd'].'< '.$this->Version['BuildNumber'].' <'.$DbRowAfter['VersionStart'].'.'.$DbRowAfter['VersionEnd'].'... '.$DbRowMiddle['VersionStart'].' '.$DbRowMiddle['VersionEnd'].'
     127      ';
     128     
     129      if (false !== strpos($Values,'[DEPRECATED'))   
     130      echo $Values;
     131     
    111132          echo('# ');
    112133          $InsertId = $this->System->Database->insert_id;
     
    153174
    154175        $Output .= '<br />'.$this->Group['Name'].'<br />';
    155         if($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1)
     176      //  if($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1)
    156177        {
    157178          $File = new FileStream();
     
    192213          $Output .= '<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />';
    193214          $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
    194         } else $Output .= ShowMessage('Již importován pro verzi '.$this->Version['Version'], MESSAGE_CRITICAL);
     215        }
     216        // else $Output .= ShowMessage('Již importován pro verzi '.$this->Version['Version'], MESSAGE_CRITICAL);
    195217      } else $Output .= ShowMessage('Není definováno jméno zdrojového souboru', MESSAGE_CRITICAL);
    196218    $Output .= ShowMessage('Dokončeno.');
     
    247269      $old = str_replace("Â", "", $old);
    248270      $old = str_replace("�", "", $old);
    249       $old = str_replace(" ", "", $old);
     271      $old = str_replace('-', '', $old);
     272      $old = str_replace(' ', '', $old);
    250273      $old = strtolower($old);
     274      $old = str_replace('$b', '', $old);
    251275 
    252276 
     
    266290      $new = str_replace("Â", "", $new);
    267291      $new = str_replace("�", "", $new);
    268       $new = str_replace(" ", "", $new);
     292      $new = str_replace('-', '', $new);
     293      $new = str_replace(' ', '', $new);
    269294      $new = strtolower($new);
     295      $new = str_replace('$b', '', $new);
    270296     
    271297      if(($old == 'null') or ($old == 'NULL')) $old = '';
    272298      if(($new == 'null') or ($new == 'NULL')) $new = '';
    273299 
    274       if(($old <> $new) and ($GroupItem['Column'] <> 'Comment'))
     300      if(($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment'))
    275301      {
    276302        //  echo $old.'X'.$new;
     
    278304      }
    279305    }
     306       
    280307    return($result);
    281308  }
  • trunk/includes/Version.php

    r680 r681  
    66// and system will need database update.
    77
    8 $Revision = 680; // Subversion revision
     8$Revision = 681; // Subversion revision
    99$DatabaseRevision = 678; // Database structure revision
    10 $ReleaseTime = '2013-12-30';
     10$ReleaseTime = '2014-01-01';
Note: See TracChangeset for help on using the changeset viewer.