Ignore:
Timestamp:
Dec 27, 2009, 8:19:32 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Generování obrázků úrovní překladatelů přesměrováno do podsložky user ve složce tmp a týmů z teams do team.
  • Upraveno: Přepracován skript pro zpracování úloh pro generování exportů DBC souborů. Nyní běží v nekončené smyčce a čeká na nové úlohy. Generování se provádí ve frontě a to i během dne.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r291 r292  
    6060    }
    6161   
    62     if($_SESSION['UserID'] != '')
     62    if(isset($_SESSION) and ($_SESSION['UserID'] != ''))
    6363    {
    6464      $DbResult = $this->Database->query('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']);
     
    234234    $this->LoadFilters();
    235235
    236     $TempDir = $this->Config['Web']['TempFolder'].$_SESSION['User'].'/dbc/';
    237     if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);
    238 
    239  
    240     foreach($TranslationTree as $Group)
    241     if(in_array($Group['Id'], $Setting['groups']) and ($Group['DBCFileName'] != ''))
    242     {
     236    $DbResult = $this->Database->query('SELECT `group`.* FROM `ExportGroup` JOIN `group` ON `group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `group`.`DBCFileName` != ""');
     237    while($Group = $DbResult->fetch_assoc())
     238    {
    243239      echo($Group['Name'].'... ');
    244240      $DBCFile = new DBCFile();
    245       $DBCFile->OpenFile('../source/'.$Setting['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($Setting['Version'],$Group['DBCFileName']));
     241      $DBCFile->OpenFile('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($Setting['Version'], $Group['DBCFileName']));
    246242      $DBCFile2 = new DBCFile();
    247       $DBCFile2->CreateFile($TempDir.$Group['DBCFileName'].'.dbc', GetDBCColumns($Setting['Version'],$Group['DBCFileName']));
     243      $DBCFile2->CreateFile($this->TempDir.$Group['DBCFileName'].'.dbc', GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']));
    248244      $Count = $DBCFile->GetRecordCount();
    249245      //if($Group['DBCFileName'] == 'Spell') $Count = 1000;
     
    253249      {
    254250        $Line = $DBCFile->GetLine($I);
    255         $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$WhereLang.' AND '.$WhereUsers.' AND (entry='.$Line[0].')  AND VersionStart <= '.GetBuildNumber($Setting['Version']).' AND VersionEnd >= '.GetBuildNumber($Setting['Version']).' ORDER BY FIELD(User, '.$SelectedUsers.')) AS T GROUP BY T.entry';       
    256         $DbResult = $this->Database->query($Query);
    257         if($DbResult->num_rows > 0)
    258         {
    259           $DbRow = $DbResult->fetch_assoc();
     251        $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';       
     252        $DbResult2 = $this->Database->query($Query);
     253        if($DbResult2->num_rows > 0)
     254        {
     255          $DbRow = $DbResult2->fetch_assoc();
    260256          //  if($Setting['Diacritics'] != 1) $Buffer = utf2ascii($Buffer);
    261257
    262           foreach($Group['Items'] as $GroupItem)
    263             if(GetDBCColumnIndex($Setting['Version'], $Group['DBCFileName'], $GroupItem['Column']) != '')
    264           $Line[GetDBCColumnIndex($this->Export['ClientVersion'], $Group['DBCFileName'],$GroupItem['Column'])] = $DbRow[$GroupItem['Column']];
     258          foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
     259            if(GetDBCColumnIndex($this->ClientVersion['Version'], $Group['DBCFileName'], $GroupItem['Column']) != '')
     260          $Line[GetDBCColumnIndex($this->ClientVersion['Version'], $Group['DBCFileName'],$GroupItem['Column'])] = $DbRow[$GroupItem['Column']];
    265261          //print_r($Line);
    266262        }
     
    279275    $this->LoadFilters();
    280276
    281     $TempDir = $this->Config['Web']['TempFolder'].$_SESSION['User'].'/lua/';
    282     if(!file_exists($TempDir)) mkdir($TempDir, 0777, true);
    283  
    284277    $DbResult = $this->Database->query('SELECT `group`.* FROM `ExportGroup` JOIN `group` ON `group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `group`.`LuaFileName` != ""');
    285278    while($Group = $DbResult->fetch_assoc())
     
    289282      $File->OpenFile('../source/'.$this->ClientVersion['Version'].'/lua/'.$Group['LuaFileName'].'.lua');
    290283      $File2 = new FileStream();
    291       $File2->CreateFile($TempDir.''.$Group['LuaFileName'].'.lua');
     284      $File2->CreateFile($this->TempDir.''.$Group['LuaFileName'].'.lua');
    292285 
    293286      while(!$File->EOF())
Note: See TracChangeset for help on using the changeset viewer.