Ignore:
Timestamp:
Jul 27, 2009, 12:49:05 PM (15 years ago)
Author:
maron
Message:

Oprava dbc exportu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r255 r264  
    281281  {
    282282        echo($Group['Name'].'... ');
    283   //  $DBCFile = new DBCFile();
    284   //  $DBCFile->OpenFile('../source/'.$Setting['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($Setting['Version'],$Group['DBCFileName']));
    285     if (copy('../source/'.$Setting['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc',$TempDir.$Group['DBCFileName'].'.dbc') == false)
    286           die('Nepodařilo se zkopírovat');
    287     $DBCFile2 = new DBCFile();
    288     $DBCFile2->OpenFile($TempDir.$Group['DBCFileName'].'.dbc', GetDBCColumns($Setting['Version'],$Group['DBCFileName']));
    289         $Count = $DBCFile2->GetRecordCount();
    290         //if($Group['DBCFileName'] == 'Spell') $Count = 1000;
    291         $Line = $DBCFile2->GetLine(0);
    292     $DBCFile2->SetRecordCount($Count);   
    293     for($I = 0; $I < $Count; $I++)
    294     {
    295       $Line = $DBCFile2->GetLine($I);
    296           $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';       
    297           $DbResult = $Database->SQLCommand($Query);
    298           if(mysql_num_rows($DbResult) > 0)
    299           {
    300             $DbRow = mysql_fetch_assoc($DbResult);
    301         //  if($Setting['Diacritics'] != 1) $Buffer = utf2ascii($Buffer);
    302 
    303         foreach($Group['Items'] as $GroupItem)
    304               if(GetDBCColumnIndex($Setting['Version'],$Group['DBCFileName'],$GroupItem['Column']) != '')
    305                 $Line[GetDBCColumnIndex($Setting['Version'],$Group['DBCFileName'],$GroupItem['Column'])] = $DbRow[$GroupItem['Column']];
    306           //print_r($Line);
    307           }
    308       $DBCFile2->SetLine($I, $Line);
    309           echo('.');
    310     }
     283            $DBCFile = new DBCFile();
     284            $DBCFile->OpenFile('../source/'.$Setting['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($Setting['Version'],$Group['DBCFileName']));
     285            $DBCFile2 = new DBCFile();
     286            $DBCFile2->CreateFile($TempDir.$Group['DBCFileName'].'.dbc', GetDBCColumns($Setting['Version'],$Group['DBCFileName']));
     287                $Count = $DBCFile->GetRecordCount();
     288        //if($Group['DBCFileName'] == 'Spell') $Count = 1000;
     289                $Line = $DBCFile->GetLine(0);
     290            $DBCFile2->SetRecordCount($Count);   
     291            for($I = 0; $I < $Count; $I++)
     292            {
     293              $Line = $DBCFile->GetLine($I);
     294                  $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';       
     295                  $DbResult = $Database->SQLCommand($Query);
     296                  if(mysql_num_rows($DbResult) > 0)
     297                  {
     298                    $DbRow = mysql_fetch_assoc($DbResult);
     299                //  if($Setting['Diacritics'] != 1) $Buffer = utf2ascii($Buffer);
     300
     301                foreach($Group['Items'] as $GroupItem)
     302                      if(GetDBCColumnIndex($Setting['Version'],$Group['DBCFileName'],$GroupItem['Column']) != '')
     303                        $Line[GetDBCColumnIndex($Setting['Version'],$Group['DBCFileName'],$GroupItem['Column'])] = $DbRow[$GroupItem['Column']];
     304                  //print_r($Line);
     305                  }
     306              $DBCFile2->SetLine($I, $Line);
     307                  echo('.');
     308            }
    311309    $DBCFile2->Commit();
    312310    echo('Hotovo <br />');
Note: See TracChangeset for help on using the changeset viewer.