Changeset 366 for trunk/import
- Timestamp:
- Mar 9, 2010, 1:01:14 PM (15 years ago)
- Location:
- trunk/import
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/import/cmd.php
r357 r366 20 20 if(strpos($parameter, '=') !== false) 21 21 { 22 $index = substr($parameter, 0,strpos($parameter, '='));23 $parameter = substr($parameter,strpos($parameter, '=')+1);24 //echo ($index.' ---- '.$parameter);22 $index = substr($parameter, 0, strpos($parameter, '=')); 23 $parameter = substr($parameter, strpos($parameter, '=') + 1); 24 //echo ($index.' ---- '.$parameter); 25 25 $_GET[$index] = $parameter; 26 26 } -
trunk/import/import_dbc.php
r365 r366 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 10 2 11 12 function ImportDBC($import_version,$GroupId) 3 function ImportDBC($import_version, $GroupId) 13 4 { 14 5 global $Database, $TranslationTree, $Config; 6 15 7 $BuildNumber = GetBuildNumber($import_version); 16 8 17 9 echo('Načítání textů z DBC souborů...'); 18 10 $Group = $TranslationTree[$GroupId]; 19 20 21 11 if(($Group['DBCFileName'] != '') and ($Group['TablePrefix'] != '')) 12 { 13 echo('<br />'.$Group['Name'].'<br />'); 22 14 $DBCFile = new DBCFile(); 23 15 $DBCFile->OpenFile('../source/'.$import_version.'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($import_version,$Group['DBCFileName'])); … … 26 18 $Count = 0; 27 19 for($i = 0; $i < $ItemCount; $i++) 20 { 21 foreach($Group['Items'] as $GroupItem) 28 22 { 29 foreach($Group['Items'] as $GroupItem) 30 { 31 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($i, GetDBCColumnIndex($import_version,$Group['DBCFileName'],$GroupItem['Column']))); 32 } 23 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($i, GetDBCColumnIndex($import_version,$Group['DBCFileName'],$GroupItem['Column']))); 24 } 33 25 34 35 36 37 38 39 26 $Columns = ''; 27 foreach($Group['Items'] as $GroupItem) 28 { 29 $Columns .= ', '.$GroupItem['Column'].' '; 30 } 31 $Columns = substr($Columns, 1); 40 32 41 42 $DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE entry='.$ItemId.' AND Language=0 ORDER BY VersionStartDESC LIMIT 1');43 33 $ItemId = $DBCFile->GetUint($i, 0); 34 $DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$Group['TablePrefix'].'` WHERE `Entry`='.$ItemId.' AND `Language`=0 ORDER BY `VersionStart` DESC LIMIT 1'); 35 if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0)) 44 36 { 45 // Update existed text 46 $DbRow2 = mysql_fetch_assoc($DbResult2); 47 if(HaveSameText($Group, $DbRow2, $Value)) 48 { 49 if ($DbRow2['VersionEnd'] <> $BuildNumber) { 50 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']); 51 echo(', '); 52 } else 53 echo('. '); 54 } else 55 { 56 $Columns = 'entry, language, VersionStart, VersionEnd'; 57 $Values = $DbRow2['entry'].', 0, '.$BuildNumber.', '.$BuildNumber; 58 foreach($Group['Items'] as $GroupItem) 59 { 60 $Columns .= ', `'.$GroupItem['Column'].'`'; 61 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 62 } 63 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 64 echo('# '); 65 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2['entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', LOG_TYPE_IMPORT); 66 } 67 37 // Update existed text 38 $DbRow2 = mysql_fetch_assoc($DbResult2); 39 if(HaveSameText($Group, $DbRow2, $Value)) 40 { 41 if ($DbRow2['VersionEnd'] <> $BuildNumber) 42 { 43 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = "'.$BuildNumber.'" WHERE `ID`='.$DbRow2['ID']); 44 echo(', '); 45 } else echo('. '); 46 } else 47 { 48 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 49 $Values = $DbRow2['entry'].', 0, '.$BuildNumber.', '.$BuildNumber; 50 foreach($Group['Items'] as $GroupItem) 51 { 52 $Columns .= ', `'.$GroupItem['Column'].'`'; 53 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 54 } 55 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 56 echo('# '); 57 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2['entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', LOG_TYPE_IMPORT); 58 } 68 59 } else 69 60 { 70 71 $Columns = 'entry, language, VersionStart, VersionEnd';72 73 74 75 76 77 78 79 80 81 61 // Insert new text 62 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 63 $Values = $ItemId.', 0, '.$BuildNumber.', '.$BuildNumber; 64 foreach($Group['Items'] as $GroupItem) 65 { 66 $Columns .= ', `'.$GroupItem['Column'].'`'; 67 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 68 } 69 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 70 echo('+ '); 71 $NewCount++; 72 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$ItemId.') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' přidán.', LOG_TYPE_IMPORT); 82 73 83 74 } 84 85 75 $Count++; 76 } 86 77 echo('<br />Celkem: '.$Count.' Nových: '.$NewCount.'<br />'); 87 $Database->SQLCommand('UPDATE `group` SET LastVersion = "'.$BuildNumber.'", LastImport = NOW() WHERE Id='.$GroupId);78 $Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$BuildNumber.'", `LastImport` = NOW() WHERE `Id`='.$GroupId); 88 79 } 89 80 echo('<strong>Dokončeno.</strong>'); -
trunk/import/import_lua.php
r363 r366 35 35 $Columns = substr($Columns, 1); 36 36 37 $DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, ` entry`, '.$Columns.' FROM '.$Group['TablePrefix'].'WHERE `ShortCut`="'.$Value['ShortCut'].'" AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1');37 $DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$Group['TablePrefix'].'` WHERE `ShortCut`="'.$Value['ShortCut'].'" AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1'); 38 38 if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0)) 39 39 { … … 50 50 } else 51 51 { 52 $Columns = '` entry`, `language`, `VersionStart`, `VersionEnd`';53 $Values = $DbRow2[' entry'].', 0, '.$BuildNumber.', '.$BuildNumber;52 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 53 $Values = $DbRow2['Entry'].', 0, '.$BuildNumber.', '.$BuildNumber; 54 54 foreach($Group['Items'] as $GroupItem) 55 55 { … … 59 59 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 60 60 echo('# '); 61 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2[' entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', LOG_TYPE_IMPORT);61 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2['Entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', LOG_TYPE_IMPORT); 62 62 } 63 63 } else … … 65 65 // Insert new text 66 66 $Entry = 1; 67 $DbResult = $Database->SQLCommand('SELECT MAX(` entry`) FROM `'.$Group['TablePrefix'].'`');67 $DbResult = $Database->SQLCommand('SELECT MAX(`Entry`) FROM `'.$Group['TablePrefix'].'`'); 68 68 if(mysql_num_rows($DbResult) > 0) 69 69 { … … 71 71 $Entry += $DbRow[0]; 72 72 } 73 $Columns = '` entry`, `language`, `VersionStart`, `VersionEnd`';73 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 74 74 $Values = $Entry.', 0, '.$BuildNumber.', '.$BuildNumber; 75 75 foreach($Group['Items'] as $GroupItem) … … 87 87 } 88 88 echo('<br />Celkem: '.$Count.' Nových: '.$NewCount.'<br />'); 89 $Database->SQLCommand('UPDATE ` group` SET LastVersion = "'.$BuildNumber.'", LastImport = NOW() WHERE Id='.$Group['Id']);89 $Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$BuildNumber.'", `LastImport` = NOW() WHERE `Id`='.$Group['Id']); 90 90 } 91 91 } -
trunk/import/import_sql_mangos.php
r357 r366 104 104 $Columns = substr($Columns, 1); 105 105 106 if($Group['Id'] == 8)$DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE Name="'.$Value['name'].'" AND (Language=0) ORDER BY VersionStartDESC LIMIT 1');107 else $DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE entry='.$Value[$Group['MangosTableIndex']].' AND (Language=0) ORDER BY VersionStartDESC LIMIT 1');106 if($Group['Id'] == 8)$DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$Group['TablePrefix'].'` WHERE `Name`="'.$Value['name'].'" AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1'); 107 else $DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, `Entry`, '.$Columns.' FROM `'.$Group['TablePrefix'].'` WHERE `Entry`='.$Value[$Group['MangosTableIndex']].' AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1'); 108 108 if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0)) 109 109 { … … 114 114 if ($DbRow2['VersionEnd'] <> $BuildNumber) 115 115 { 116 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']);116 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = "'.$BuildNumber.'" WHERE `ID`='.$DbRow2['ID']); 117 117 echo(', '); 118 118 } else echo('. '); 119 119 } else 120 120 { 121 $Columns = ' entry, language, VersionStart, VersionEnd';122 $Values = $DbRow2[' entry'].', 0, '.$BuildNumber.', '.$BuildNumber;121 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 122 $Values = $DbRow2['Entry'].', 0, '.$BuildNumber.', '.$BuildNumber; 123 123 foreach($Group['Items'] as $GroupItem) 124 124 { … … 131 131 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 132 132 echo('# '); 133 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2[' entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', LOG_TYPE_IMPORT);133 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.mysql_insert_id().'</a> ('.$DbRow2['Entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', LOG_TYPE_IMPORT); 134 134 } else echo('. '); 135 135 } … … 141 141 { 142 142 $Entry = 1; 143 $DbResult = $Database->SQLCommand('SELECT MAX(` entry`) FROM `'.$Group['TablePrefix'].'`');143 $DbResult = $Database->SQLCommand('SELECT MAX(`Entry`) FROM `'.$Group['TablePrefix'].'`'); 144 144 if(mysql_num_rows($DbResult) > 0) 145 145 { … … 151 151 } 152 152 153 $Columns = ' entry, language, VersionStart, VersionEnd';153 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 154 154 $Values = $Entry.', 0, '.$BuildNumber.', '.$BuildNumber; 155 155 foreach($Group['Items'] as $GroupItem) … … 168 168 } 169 169 echo('<br />Celkem: '.$Count.' Nových: '.$NewCount.'<br />'); 170 $Database->SQLCommand('UPDATE ` group` SET LastVersion = "'.$BuildNumber.'", LastImport = NOW() WHERE Id='.$GroupId);170 $Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$BuildNumber.'", `LastImport` = NOW() WHERE `Id`='.$GroupId); 171 171 } 172 172 -
trunk/import/update_version.php
r215 r366 9 9 { 10 10 echo('<br />'.$Group['Name'].' '); 11 $DbResult = $Database->SQLCommand('SELECT gs_tran.ID, gs_tran.VersionEnd AS VersionEnd_tran, gs_orig.VersionEnd AS VersionEnd_orig FROM '.$Group['TablePrefix'].' AS gs_tran JOIN '.$Group['TablePrefix'].' AS gs_orig ON gs_orig.ID = gs_tran.Take WHERE gs_tran.VersionEnd <> gs_orig.VersionEnd');11 $DbResult = $Database->SQLCommand('SELECT `gs_tran`.`ID`, `gs_tran`.`VersionEnd` AS `VersionEnd_tran`, `gs_orig`.`VersionEnd` AS `VersionEnd_orig` FROM `'.$Group['TablePrefix'].'` AS `gs_tran` JOIN `'.$Group['TablePrefix'].'` AS `gs_orig` ON `gs_orig`.`ID` = `gs_tran`.`Take` WHERE `gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd`'); 12 12 while($DbRow = mysql_fetch_assoc($DbResult)) 13 13 { 14 $Database->SQLCommand('UPDATE '.$Group['TablePrefix'].' SET VersionEnd = '.$DbRow['VersionEnd_orig'].' WHERE ID= '.$DbRow['ID']);14 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$DbRow['VersionEnd_orig'].' WHERE `ID` = '.$DbRow['ID']); 15 15 echo('. '); 16 16 }
Note:
See TracChangeset
for help on using the changeset viewer.