Ignore:
Timestamp:
Mar 9, 2010, 3:22:30 PM (14 years ago)
Author:
maron
Message:

Export dbc souborů pomocí programu DBCExport

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r366 r369  
    3030    $DbResult = $this->Database->query('SELECT * FROM `ExportLanguage` WHERE `Export`='.$this->Id.' ORDER BY `Sequence`');
    3131    while($Language = $DbResult->fetch_assoc())
    32       $this->WhereLang .= ' OR (`Language` = '.$Language['Language'].')';
     32      $this->WhereLang .= ' OR (Language = '.$Language['Language'].')';
    3333    if($this->WhereLang == '') $this->WhereLang = 1;
    3434      else $this->WhereLang = '('.substr($this->WhereLang, 4).')';
     
    5252    } else
    5353    {
    54       $this->WhereUsers = '(`User` IN ('.$this->SelectedUsers.'))';
    55       $this->OrderByUserList = ' ORDER BY FIELD(`User`, '.$this->SelectedUsers.')';
     54      $this->WhereUsers = '(User IN ('.$this->SelectedUsers.'))';
     55      $this->OrderByUserList = ' ORDER BY FIELD(User, '.$this->SelectedUsers.')';
    5656    }
    5757   
     
    237237    {
    238238      echo($Group['Name'].'... ');
    239       if(file_exists('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'))
    240       {
    241       $DBCFile = new DBCFile();
    242       $DBCFile->OpenFile('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']));
    243       $DBCFile2 = new DBCFile();
    244       if(!file_exists($this->TempDir.'dbc/')) mkdir($this->TempDir.'dbc/', 0777, true);     
    245       $DBCFile2->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']));
    246       $Count = $DBCFile->GetRecordCount();
    247       //if($Group['DBCFileName'] == 'Spell') $Count = 1000;
    248       $Line = $DBCFile->GetLine(0);
    249       $DBCFile2->SetRecordCount($Count);   
    250       for($I = 0; $I < $Count; $I++)
    251       {
    252         $Line = $DBCFile->GetLine($I);
    253         $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (`Entry`='.$Line[0].')  AND `VersionStart` <= '.$this->ClientVersion['BuildNumber'].' AND `VersionEnd` >= '.$this->ClientVersion['BuildNumber'].' ORDER BY FIELD(`User`, '.$this->SelectedUsers.')) AS `T` GROUP BY `T`.`Entry`';       
    254         $DbResult2 = $this->Database->query($Query);
    255         if($DbResult2->num_rows > 0)
    256         {
    257           $DbRow = $DbResult2->fetch_assoc();
    258           //  if($Setting['Diacritics'] != 1) $Buffer = utf2ascii($Buffer);
    259 
    260           foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    261             if(GetDBCColumnIndex($this->ClientVersion['Version'], $Group['DBCFileName'], $GroupItem['Column']) != '')
    262           $Line[GetDBCColumnIndex($this->ClientVersion['Version'], $Group['DBCFileName'],$GroupItem['Column'])] = $DbRow[$GroupItem['Column']];
    263           //print_r($Line);
    264         }
    265         $DBCFile2->SetLine($I, $Line);
    266         echo('.');
    267       }
    268       $DBCFile2->Commit();
    269       echo('Hotovo <br />');
    270     } else echo('Zdrojový soubor '.'../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n");
     239        if(file_exists('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) {
     240                 
     241         $i = 1;
     242         $columns = '';
     243         foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     244           $columns .= ' T.'.$Column['Column'].' as text'.$i.',';
     245           $i = $i+1;
     246         }
     247         
     248         $querty = '"SELECT '.$columns.' T.entry as entry FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].') AS T GROUP BY T.entry"';
     249     
     250       $params = ' -f ../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc -n '.$this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc -c '.GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']).' -q '.$querty;
     251     
     252       exec('./DBCExport '.$params);
     253       
     254      echo('Hotovo <br />
     255');
     256      } else echo('Zdrojový soubor '.'../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n");
    271257    }
    272258  }
Note: See TracChangeset for help on using the changeset viewer.