Ignore:
Timestamp:
Dec 28, 2009, 2:32:52 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Proces generování DBC a Lua souborů.
  • Opraveno: Generování SQL pro AoWoW.
  • Přidáno: Zadání popisu exportu při vytváření nového.
  • Opraveno: Soubory jednotlivých formátů výstupů exportů ukládat do samostatných podsložek a z nich pak vytvářet zip balíčky.
  • Přidáno: Omezení max. počtu vytvořených exportů na překladatele. Výchozí limit je 10.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r293 r297  
    3636    // Filter selected users
    3737    $this->SelectedUsers = ''; 
    38     $DbResult = $this->Database->query('SELECT * FROM `ExportUser` WHERE Export='.$this->Id.' ORDER BY Sequence');
     38    $this->UserNames = '';
     39    $DbResult = $this->Database->query('SELECT ExportUser.*, user.user FROM `ExportUser` LEFT JOIN user ON user.ID=ExportUser.User WHERE ExportUser.Export='.$this->Id.' ORDER BY ExportUser.Sequence');
    3940    while($User = $DbResult->fetch_assoc())
     41    {
    4042      $this->SelectedUsers .= ','.$User['User'];
     43      $this->UserNames .= ','.$User['user'];
     44    }
    4145    $this->SelectedUsers = substr($this->SelectedUsers, 1);
    42    
    43     if($this->SelectedUsers == '') $Where = 0;
    44       else $Where = 'ID IN ('.$this->SelectedUsers.')';
    45  
    46     $this->UserNames = '';
    47     $DbResult = $this->Database->query('SELECT user FROM `user` WHERE '.$Where);
    48     while($DbRow = $DbResult->fetch_assoc())
    49       $this->UserNames .= ','.$DbRow['user'];
    50     $this->UserNames = substr($this->UserNames, 1);   
     46    $this->UserNames = substr($this->UserNames, 1);     
    5147   
    5248    if($this->SelectedUsers == '')
    5349    {
    54       $this->WhereUsers = 1;
     50      $this->WhereUsers = 0;
    5551      $this->OrderByUserList = '';
    5652    } else
     
    6056    }
    6157   
     58    // Load logged user
    6259    if(isset($_SESSION) and ($_SESSION['UserID'] != ''))
    6360    {
     
    10198      if($Group['MangosTable'] != '')
    10299      {
    103         $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND '.$this->WhereUsers.' ORDER BY FIELD(User, '.$this->SelectedUsers.')) AS T GROUP BY T.entry'; 
     100        $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T GROUP BY T.entry'; 
    104101        //echo($Query);
    105102        $Buffer .= "\n\n-- ".$Group['Name']."\n\n";
     
    129126 
    130127    $Buffer = $this->ExportToMangosSQL();
    131  
    132     $this->LoadFilters();
    133 
     128 
    134129    // Data to aowow
    135130
     
    137132    $Database2->query('SET NAMES '.$this->Config['Database']['Charset']);
    138133    $Database2->select_db($AoWoWconf['mangos']['db']);   
    139     $AoWoWTables = array('aowow_resistances' => 'Id', 'aowow_spelldispeltype' => 'Id', 'aowow_skill' => 'skillID');
     134    $AoWoWTables = array(
     135      'aowow_resistances' => 'Id',
     136      'aowow_spelldispeltype' => 'Id',
     137      'aowow_skill' => 'skillID',
     138    );
    140139    foreach($AoWoWTables as $AoWoWTable => $IndexColum)
    141140    {
     
    147146      {
    148147        $Ori_text = $Line['name'];
    149         $DbResult2 = $Datbase2->query('SELECT text as en,
     148        $DbResult2 = $Database2->query('SELECT text as en,
    150149        (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran
    151          WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$WhereLang.'
    152           AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.') LIMIT 1) as tran
     150         WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$this->WhereLang.'
     151          AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran
    153152         FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE
    154153          text = "'.addslashes($Ori_text).'" LIMIT 1');
     
    160159          (SELECT OptionText FROM '.$this->Config['Database']['Database'].'.npc_option as tabletran
    161160           WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$this->WhereLang.'
    162             AND '.$this->WhereUsers.' ORDER BY FIELD(User, '.$this->SelectedUsers.') LIMIT 1) as tran
     161            AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran
    163162          FROM '.$this->Config['Database']['Database'].'.npc_option as tableen WHERE
    164163            OptionText = "'.addslashes($Ori_text).'" LIMIT 1');
     
    205204        $Group['MangosTableIndex'] = 'entry';
    206205      }
    207       $Query = 'SELECT *,(SELECT user FROM user WHERE user.ID=T.User) as UserName FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND '.$this->WhereUsers.' ORDER BY FIELD(User, '.$this->SelectedUsers.')) AS T GROUP BY T.entry';
    208       //echo($Query);
     206      $Query = 'SELECT *,(SELECT user FROM user WHERE user.ID=T.User) as UserName FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND (VersionStart <= '.$this->ClientVersion['BuildNumber'].') AND (VersionEnd >= '.$this->ClientVersion['BuildNumber'].') AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T GROUP BY T.entry';
     207      echo($Query);
    209208      $Buffer .= '    <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n";
    210209      $DbResult2 = $this->Database->query($Query);
     
    239238    {
    240239      echo($Group['Name'].'... ');
     240      if(file_exists('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'))
     241      {
    241242      $DBCFile = new DBCFile();
    242       $DBCFile->OpenFile('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($Setting['Version'], $Group['DBCFileName']));
     243      $DBCFile->OpenFile('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']));
    243244      $DBCFile2 = new DBCFile();
    244       $DBCFile2->CreateFile($this->TempDir.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']));
     245      if(!file_exists($this->TempDir.'dbc/')) mkdir($this->TempDir.'dbc/', 0777, true);     
     246      $DBCFile2->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']));
    245247      $Count = $DBCFile->GetRecordCount();
    246248      //if($Group['DBCFileName'] == 'Spell') $Count = 1000;
     
    267269      $DBCFile2->Commit();
    268270      echo('Hotovo <br />');
     271    } else echo('Zdrojový soubor '.'../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n");
    269272    }
    270273  }
     
    283286      $File->OpenFile('../source/'.$this->ClientVersion['Version'].'/lua/'.$Group['LuaFileName'].'.lua');
    284287      $File2 = new FileStream();
    285       $File2->CreateFile($this->TempDir.''.$Group['LuaFileName'].'.lua');
     288      if(!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true);
     289      $File2->CreateFile($this->TempDir.'lua/'.$Group['LuaFileName'].'.lua');
    286290 
    287291      while(!$File->EOF())
     
    296300          $Value['Comment'] = addslashes(substr(trim($LineParts[1]), 3));
    297301
    298           $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (ShortCut="'.$Value['ShortCut'].'") AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' ORDER BY FIELD(User, '.$this->SelectedUsers.')) AS T GROUP BY T.entry';
     302          $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (ShortCut="'.$Value['ShortCut'].'") AND (VersionStart <= '.$this->ClientVersion['BuildNumber'].') AND (VersionEnd >= '.$this->ClientVersion['BuildNumber'].')'.$this->OrderByUserList.') AS T GROUP BY T.entry';
    299303          //echo($Query);
    300304          $DbResult2 = $this->Database->query($Query);
Note: See TracChangeset for help on using the changeset viewer.