Changeset 216 for trunk/import
- Timestamp:
- Jun 24, 2009, 10:30:42 PM (15 years ago)
- Location:
- trunk/import
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/import/import_dbc.php
r214 r216 1 1 <?php 2 /* 3 DELETE FROM `gametips` WHERE ID > 266; 4 DELETE FROM `spell` WHERE ID > 43672; 5 UPDATE `gametips` SET VersionStart = 8606,VersionEnd = 8606; 6 UPDATE `spell` SET VersionStart = 8606,VersionEnd = 8606; 7 DELETE FROM `log` WHERE Type = 11; 8 */ 9 2 10 3 function ImportDBC() 11 12 function ImportDBC($import_version) 4 13 { 5 14 global $Database, $TranslationTree, $Config; 15 $BuildNumber = GetBuildNumber($import_version); 6 16 7 17 echo('Načítání textů z DBC souborů...'); … … 12 22 echo('<br />'.$Group['Name'].'<br />'); 13 23 $DBCFile = new DBCFile(); 14 $DBCFile->OpenFile('../source/'.$ Config['Web']['GameVersion'].'/dbc/'.$Group['DBCFileName'].'.dbc', $Group['DBCColumns']);24 $DBCFile->OpenFile('../source/'.$import_version.'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($import_version,$Group['DBCFileName'])); 15 25 $ItemCount = $DBCFile->GetRecordCount(); 16 26 $NewCount = 0; … … 18 28 for($i = 0; $i < $ItemCount; $i++) 19 29 { 30 foreach($Group['Items'] as $GroupItem) 31 { 32 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($i, GetDBCColumnIndex($import_version,$Group['DBCFileName'],$GroupItem['Column']))); 33 } 34 35 $Columns = ''; 36 foreach($Group['Items'] as $GroupItem) 37 { 38 $Columns .= ', '.$GroupItem['Column'].' '; 39 } 40 $Columns = substr($Columns, 1); 41 20 42 $ItemId = $DBCFile->GetUint($i, 0); 21 $DbResult2 = $Database->SQLCommand('SELECT ID FROM '.$Group['TablePrefix'].' WHERE entry='.$ItemId.' AND Language=0');43 $DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE entry='.$ItemId.' AND Language=0 ORDER BY VersionStart DESC LIMIT 1'); 22 44 if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0)) 23 45 { 24 $DbRow2 = mysql_fetch_assoc($DbResult2); 25 //echo($DbRow2['ID']); 26 $ColumnsValues = ''; 27 foreach($Group['Items'] as $GroupItem) 28 { 29 $ColumnsValues .= ', `'.$GroupItem['Column'].'`="'.addslashes($DBCFile->GetString($i, $GroupItem['DBCColumnIndex'])).'"'; 30 } 31 $ColumnsValues = substr($ColumnsValues, 2); 32 echo('. '); //'UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']."<br>"); 33 //print_r($DbRow2); 34 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']); 46 // Update existed text 47 $DbRow2 = mysql_fetch_assoc($DbResult2); 48 if(HaveSameText($Group, $DbRow2, $Value)) 49 { 50 if ($DbRow2['VersionEnd'] <> $BuildNumber) { 51 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']); 52 echo(', '); 53 } else 54 echo('. '); 55 } else 56 { 57 $Columns = 'entry, language, VersionStart, VersionEnd'; 58 $Values = $DbRow2['entry'].', 0, '.$BuildNumber.', '.$BuildNumber; 59 foreach($Group['Items'] as $GroupItem) 60 { 61 $Columns .= ', `'.$GroupItem['Column'].'`'; 62 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 63 } 64 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 65 echo('# '); 66 $NewCount++; 67 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.$DbRow2['ID'].'">'.$DbRow2['ID'].'</a> ('.$DbRow2['entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', 11); 68 } 69 35 70 } else 36 { 37 $Columns = 'entry, language';38 $Values = $ItemId.', 0';39 foreach($Group['Items'] as $GroupItem) 40 { 41 $Columns .= ', `'.$GroupItem['Column'].'`'; 42 $Values .= ', "'.addslashes($DBCFile->GetString($i, $GroupItem['DBCColumnIndex'])).'"';43 } 44 //$Columns = substr($Columns, 2); 45 //$Values = substr($Values, 2);46 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');47 echo('# ');48 //echo('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'."<br>");49 $NewCount++; 71 { 72 // Insert new text 73 $Columns = 'entry, language, VersionStart, VersionEnd'; 74 $Values = $ItemId.', 0, '.$BuildNumber.', '.$BuildNumber; 75 foreach($Group['Items'] as $GroupItem) 76 { 77 $Columns .= ', `'.$GroupItem['Column'].'`'; 78 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 79 } 80 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 81 echo('+ '); 82 $NewCount++; 83 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.$DbRow2['ID'].'</a> ('.$ItemId.') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' přidán.', 11); 84 50 85 } 51 86 $Count++; -
trunk/import/import_lua.php
r215 r216 1 1 <?php 2 3 function HaveSameText($Group, $DbRow2, $Value)4 {5 $result = true;6 foreach($Group['Items'] as $GroupItem)7 {8 $old = $DbRow2[$GroupItem['Column']];9 $old = str_replace(chr(10), '', $old);10 $old = str_replace(chr(13), '', $old);11 $old = str_replace('\n', '', $old);12 $old = str_replace('\r', '', $old);13 $old = str_replace('\"', '"', $old);14 $old = str_replace('\\\\', '\\', $old);15 $old = str_replace('\32', '32', $old);16 $old = str_replace('\124', '124', $old);17 18 $new = $Value[$GroupItem['Column']];19 $new = str_replace(chr(10), '', $new);20 $new = str_replace(chr(13), '', $new);21 $new = str_replace('\n', '', $new);22 $new = str_replace('\r', '', $new);23 $new = str_replace('\"', '"', $new);24 $new = str_replace('\\\\', '\\', $new);25 $new = str_replace('\32', '32', $new);26 $new = str_replace('\124', '124', $new);27 28 if(($old <> $new) and ($GroupItem['Column'] <> 'Comment'))29 {30 // echo $old.'-'.$new;31 $result = false;32 }33 }34 return($result);35 }36 2 37 3 function ImportLUA($import_version) 38 4 { 39 5 global $Database, $TranslationTree, $PatchVersion, $Config; 6 $BuildNumber = GetBuildNumber($import_version); 40 7 41 8 echo('Načítání textů z LUA souborů...'); … … 74 41 if(HaveSameText($Group, $DbRow2, $Value)) 75 42 { 76 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.GetBuildNumber($import_version).'" WHERE ID='.$DbRow2['ID']); 43 if ($DbRow2['VersionEnd'] <> $BuildNumber) { 44 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']); 45 echo(', '); 46 } else 47 echo('. '); 77 48 } else 78 49 { 79 50 $Columns = 'entry, language, VersionStart, VersionEnd'; 80 $Values = $DbRow2['entry'].', 0, '. GetBuildNumber($import_version).', '.GetBuildNumber($import_version);51 $Values = $DbRow2['entry'].', 0, '.$BuildNumber.', '.$BuildNumber; 81 52 foreach($Group['Items'] as $GroupItem) 82 53 { … … 89 60 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.$DbRow2['ID'].'">'.$DbRow2['ID'].'</a> ('.$DbRow2['entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', 11); 90 61 } 91 echo('. ');92 62 } else 93 63 { … … 101 71 } 102 72 $Columns = 'entry, language, VersionStart, VersionEnd'; 103 $Values = $Entry.', 0, '. GetBuildNumber($import_version).', '.GetBuildNumber($import_version);73 $Values = $Entry.', 0, '.$BuildNumber.', '.$BuildNumber; 104 74 foreach($Group['Items'] as $GroupItem) 105 75 { … … 108 78 } 109 79 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 110 echo(' #');80 echo('+ '); 111 81 $NewCount++; 112 82 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.$DbRow2['ID'].'</a> ('.$Entry.') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' přidán.', 11); -
trunk/import/index.php
r215 r216 23 23 echo('<div><a href="?source=lua">LUA soubory</a></div>'); 24 24 echo('<div><a href="generatecodeXML.php">xml soubory</a></div>'); 25 echo('<div><a href="?source=update_version">aktualizace verze u překladů</a></div>'); 25 26 } else 26 27 { … … 32 33 break; 33 34 case 'dbc': 34 ImportDBC(); 35 ImportDBC($Config['Web']['GameVersion']); 36 break; 37 case 'update_version': 38 UpdateVersion(); 35 39 break; 36 40 case 'lua':
Note:
See TracChangeset
for help on using the changeset viewer.