Changeset 443 for trunk/import
- Timestamp:
- Apr 11, 2010, 11:48:39 AM (15 years ago)
- Location:
- trunk/import
- Files:
-
- 2 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>'); -
trunk/import/index.php
r388 r443 78 78 echo($Order['Output']); 79 79 80 $ID = $Database->SQLCommand('SELECT * , CONCAT(`MangosDatabase`, ".", `MangosTable`, ", ", `DBCFileName`, ".dbc, ", `LuaMPQFolder`, "/", `LuaFileName`, ".lua" ) AS `SourceName`FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);80 $ID = $Database->SQLCommand('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 81 81 while($Group = mysql_fetch_assoc($ID)) 82 82 { 83 echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['SourceType'].'</td><td>'.$Group['SourceName'].'</td><td><a title="Změny po posledním importu u vybrané překladové skupiny" href="log.php?group='.$Group['Id'].'&type=11">'.HumanDate($Group['LastImport']).'</a></td><td>'.GetVersionWOW($Group['LastVersion']).'</td><td><a href="?action=importgroup&id='.$Group['Id'].'">Importovat</a></td></tr>'); 83 echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['SourceType'].'</td><td>'); 84 if($Group['MangosTable'] != '') echo($Group['MangosTable'].'.sql '); 85 if($Group['DBCFileName'] != '') echo($Group['DBCFileName'].'.dbc '); 86 if($Group['LuaFileName'] != '') echo($Group['LuaFileName'].'.lua '); 87 echo('</td><td><a title="Změny po posledním importu u vybrané překladové skupiny" href="log.php?group='.$Group['Id'].'&type=11">'.HumanDate($Group['LastImport']).'</a></td><td>'.GetVersionWOW($Group['LastVersion']).'</td><td><a href="?action=importgroup&id='.$Group['Id'].'">Importovat</a></td></tr>'); 84 88 } 85 89 echo('</table>');
Note:
See TracChangeset
for help on using the changeset viewer.