Changeset 408 for trunk/export


Ignore:
Timestamp:
Mar 28, 2010, 6:19:16 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Export Lua souborů. Chybně se zde opakovalo načítání textů z databáze pro každý řádek Lua souborů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r407 r408  
    5050    ' ORDER BY `ExportLanguage`.`Sequence`, `ExportUser`.`Sequence`) AS `TT` GROUP BY `TT`.`Entry`';
    5151   
     52    // Build columns for english texts
    5253    $OriginalColumns = '';
    5354    foreach($TranslationTree[$Group['Id']]['Items'] as $Column)
     
    5556    $OriginalColumns = substr($OriginalColumns, 0, -2);
    5657   
     58    // Expand query for loading english texts
    5759    $Query = 'SELECT `T4`.*, '.$OriginalColumns.' FROM ('.$Query.') AS `T4` '.
    5860    ' LEFT JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T3`.`Entry` = `T4`.`Entry`) AND (`T3`.`Language` = 0) AND (`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 
    59     echo($Query);
     61
    6062    return($Query);
    6163  }
     
    282284      $File2->CreateFile($this->TempDir.'lua/'.$Group['LuaFileName'].'.lua');
    283285     
     286      $LookupTable = array();
    284287      $DbResult2 = $this->Database->query($this->BuildQuery($Group));
     288      while($DbRow = $DbResult2->fetch_assoc())
     289        $LookupTable[$DbRow['ShortCut']] = $DbRow;
    285290       
    286291      while(!$File->EOF())
     
    295300          $Value['Comment'] = substr(trim($LineParts[1]), 3);
    296301
    297           if($DbResult2->num_rows > 0)
     302          if(array_key_exists($Value['ShortCut'], $LookupTable))
    298303          {
    299             $DbRow = $DbResult2->fetch_assoc();
     304            $DbRow = $LookupTable[$Value['ShortCut']];
    300305            $Value['Text'] = addslashes($DbRow['Text']);
    301306            // Escape new line control characters
Note: See TracChangeset for help on using the changeset viewer.