Ignore:
Timestamp:
Apr 11, 2010, 11:48:39 AM (14 years ago)
Author:
george
Message:
  • Upraveno: Přepracována a vylepšena třídy DBC. Nově je formát sloupců určen pomocí pole párů indexů a typů. Doplněny optimalizace předvytvoření prázdných polí se známou velikostí.
  • Upraveno: Přepracován systém určování textových sloupců DBC souborů dle verzí klienta. Vytvořena samostatná tabulka GroupItemDBC obsahující sloupce id verze klienta, id položky GroupItem a index v DBC souboru. Odstraněny podobné údaje z ClientVersion. Upraven DBC import a export.
  • Přidáno: Další překladové skupiny z DBC souborů.
  • Upraveno: Export přepracován pro jednoduchost zpět na PHP pomalou variantu. Bude později přepracován a zoptimalizován.
  • Přidáno: Zobrazení času úpravy překladu.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/import/import.php

    r392 r443  
    99  function SetVersion($Version)
    1010  {
    11     global $Database;
     11    global $System;
    1212   
    13     $DbResult = $Database->SQLCommand('SELECT * FROM `ClientVersion` WHERE `Version` = "'.$Version.'"');
    14     $this->Version = mysql_fetch_assoc($DbResult); 
     13    $DbResult = $System->Database->query('SELECT * FROM `ClientVersion` WHERE `Version` = "'.$Version.'"');
     14    $this->Version = $DbResult->fetch_assoc(); 
    1515  }
    1616 
     
    199199  function ImportDBC()
    200200  {
    201     global $Database, $TranslationTree, $Config;
     201    global $System, $TranslationTree, $Config;
    202202 
    203203    echo('Načítání textů z DBC souboru...');
     
    205205    {
    206206      echo('<br />'.$this->Group['Name'].'<br />');
     207
     208      // Load string column index list
     209      $DbResult = $System->Database->query('SELECT * FROM `GroupItem` JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->Version['Id'].'  WHERE `GroupItem`.`Group` = '.$this->Group['Id']);     
     210      $ColumnIndexes = array();
     211      $ColumnFormat = array();
     212      while($DbRow = $DbResult->fetch_assoc())
     213      {
     214        $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING;
     215        $ColumnIndexes[$DbRow['GroupItem']] = $DbRow['ColumnIndex'];
     216      }
     217     
    207218      $DBCFile = new DBCFile();
    208           $DBCFile->OpenFile('../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', GetDBCColumns($this->Version['Version'], $this->Group['DBCFileName']));
     219      $DBCFile->OpenFile('../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', $ColumnFormat);
    209220      $ItemCount = $DBCFile->GetRecordCount();
    210221      $this->NewItemCount = 0;
    211       $Count = 0;
    212       for($i = 0; $i < $ItemCount; $i++)
     222      $Count = 0;     
     223       
     224      for($I = 0; $I < $ItemCount; $I++)
    213225      {
    214226        foreach($this->Group['Items'] as $GroupItem)
    215227        {
    216           $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($i, GetDBCColumnIndex($this->Version['Version'], $this->Group['DBCFileName'], $GroupItem['Column'])));
     228          $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']]));
    217229        }
    218         $Value['Entry'] = $DBCFile->GetUint($i, 0); 
     230        $Value['Entry'] = $DBCFile->GetUint($I, 0); 
    219231        $this->InsertItem($Value);
    220232        $Count++;
    221233      }   
    222234      echo('<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />');
    223       $Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
     235      $System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
    224236    }
    225237    echo('<strong>Dokončeno.</strong>');
Note: See TracChangeset for help on using the changeset viewer.