Changeset 443 for trunk/export/export.php
- Timestamp:
- Apr 11, 2010, 11:48:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/export.php
r417 r443 247 247 if(file_exists('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 248 248 { 249 $I = 1; 250 $Columns = ''; 251 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) 252 { 253 $Columns .= '`T`.`'.$Column['Column'].'` AS `Text'.$I.'`, '; 254 $I = $I + 1; 249 // Load string column index list 250 $DbResult = $this->Database->query('SELECT * FROM `GroupItem` JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']); 251 $ColumnIndexes = array(); 252 $ColumnFormat = array(); 253 while($DbRow = $DbResult->fetch_assoc()) 254 { 255 $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING; 256 $ColumnIndexes[$DbRow['GroupItem']] = $DbRow['ColumnIndex']; 255 257 } 256 258 257 $Query = $this->BuildQuery($Group, $Columns); 258 $Query = str_replace('`', '\`', $Query); 259 $Query = '"'.str_replace(' ', '\ ', $Query).'"'; 259 // Load all data into lookup table 260 $LookupTable = array(); 261 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 262 while($DbRow = $DbResult2->fetch_assoc()) 263 $LookupTable[$DbRow['Entry']] = $DbRow; 260 264 261 $Params = '-u '.$Config['Database']['User'].' -p '.$Config['Database']['Password'].' -f ../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc -n '.$this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc -c '.GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']).' -q '.$Query; 262 263 exec('./DBCExport '.$Params); 264 265 // Open original DBC file 266 $SourceDBCFile = new DBCFile(); 267 $SourceDBCFile->OpenFile('../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat); 268 269 // Create new DBC file 270 if(!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true); 271 $NewDBCFile = new DBCFile(); 272 $NewDBCFile->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat); 273 $NewDBCFile->SetRecordCount($SourceDBCFile->GetRecordCount()); 274 $NewDBCFile->SetFieldCount($SourceDBCFile->GetFieldCount()); 275 $NewDBCFile->Commit(); 276 277 // Replace translated strings 278 $OldProgress = -1; 279 echo("\n\r"); 280 $RowCount = $SourceDBCFile->GetRecordCount(); 281 $FieldCount = $SourceDBCFile->GetFieldCount(); 282 for($Row = 0; $Row < $RowCount; $Row++) 283 { 284 $Line = $SourceDBCFile->GetLine($Row); 285 /*foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 286 { 287 if(array_key_exists($GroupItem['Id'], $ColumnIndexes) and array_key_exists($Row, $LookupTable)) 288 $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTable[$Row][$GroupItem['Column']]; 289 } 290 */ 291 $NewDBCFile->SetLine($Row, $Line); 292 293 // Show completion progress 294 $Progress = round($Row / $RowCount * 100); 295 if($Progress != $OldProgress) 296 { 297 echo($Progress."%\r"); 298 $OldProgress = $Progress; 299 } 300 } 301 $NewDBCFile->Commit(); 265 302 } else echo('Zdrojový soubor '.'../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n"); 266 303 }
Note:
See TracChangeset
for help on using the changeset viewer.