Changeset 443 for trunk/import/import.php
- Timestamp:
- Apr 11, 2010, 11:48:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/import/import.php
r392 r443 9 9 function SetVersion($Version) 10 10 { 11 global $ Database;11 global $System; 12 12 13 $DbResult = $ Database->SQLCommand('SELECT * FROM `ClientVersion` WHERE `Version` = "'.$Version.'"');14 $this->Version = mysql_fetch_assoc($DbResult);13 $DbResult = $System->Database->query('SELECT * FROM `ClientVersion` WHERE `Version` = "'.$Version.'"'); 14 $this->Version = $DbResult->fetch_assoc(); 15 15 } 16 16 … … 199 199 function ImportDBC() 200 200 { 201 global $ Database, $TranslationTree, $Config;201 global $System, $TranslationTree, $Config; 202 202 203 203 echo('Načítání textů z DBC souboru...'); … … 205 205 { 206 206 echo('<br />'.$this->Group['Name'].'<br />'); 207 208 // Load string column index list 209 $DbResult = $System->Database->query('SELECT * FROM `GroupItem` JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->Version['Id'].' WHERE `GroupItem`.`Group` = '.$this->Group['Id']); 210 $ColumnIndexes = array(); 211 $ColumnFormat = array(); 212 while($DbRow = $DbResult->fetch_assoc()) 213 { 214 $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING; 215 $ColumnIndexes[$DbRow['GroupItem']] = $DbRow['ColumnIndex']; 216 } 217 207 218 $DBCFile = new DBCFile(); 208 $DBCFile->OpenFile('../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', GetDBCColumns($this->Version['Version'], $this->Group['DBCFileName']));219 $DBCFile->OpenFile('../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', $ColumnFormat); 209 220 $ItemCount = $DBCFile->GetRecordCount(); 210 221 $this->NewItemCount = 0; 211 $Count = 0; 212 for($i = 0; $i < $ItemCount; $i++) 222 $Count = 0; 223 224 for($I = 0; $I < $ItemCount; $I++) 213 225 { 214 226 foreach($this->Group['Items'] as $GroupItem) 215 227 { 216 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($ i, GetDBCColumnIndex($this->Version['Version'], $this->Group['DBCFileName'], $GroupItem['Column'])));228 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']])); 217 229 } 218 $Value['Entry'] = $DBCFile->GetUint($ i, 0);230 $Value['Entry'] = $DBCFile->GetUint($I, 0); 219 231 $this->InsertItem($Value); 220 232 $Count++; 221 233 } 222 234 echo('<br />Celkem: '.$Count.' Nových: '.$this->NewItemCount.'<br />'); 223 $ Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);235 $System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']); 224 236 } 225 237 echo('<strong>Dokončeno.</strong>');
Note:
See TracChangeset
for help on using the changeset viewer.