Changeset 357 for trunk/import/import_dbc.php
- Timestamp:
- Mar 5, 2010, 7:42:00 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/import/import_dbc.php
r250 r357 19 19 if(($Group['DBCFileName'] != '') and ($Group['TablePrefix'] != '')) 20 20 { 21 echo('<br />'.$Group['Name'].'<br />'); 22 23 24 25 26 27 21 echo('<br />'.$Group['Name'].'<br />'); 22 $DBCFile = new DBCFile(); 23 $DBCFile->OpenFile('../source/'.$import_version.'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($import_version,$Group['DBCFileName'])); 24 $ItemCount = $DBCFile->GetRecordCount(); 25 $NewCount = 0; 26 $Count = 0; 27 for($i = 0; $i < $ItemCount; $i++) 28 28 { 29 29 foreach($Group['Items'] as $GroupItem) … … 31 31 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($i, GetDBCColumnIndex($import_version,$Group['DBCFileName'],$GroupItem['Column']))); 32 32 } 33 33 34 34 $Columns = ''; 35 35 foreach($Group['Items'] as $GroupItem) … … 38 38 } 39 39 $Columns = substr($Columns, 1); 40 40 41 41 $ItemId = $DBCFile->GetUint($i, 0); 42 42 $DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE entry='.$ItemId.' AND Language=0 ORDER BY VersionStart DESC LIMIT 1'); 43 43 if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0)) 44 44 { 45 45 // Update existed text 46 46 $DbRow2 = mysql_fetch_assoc($DbResult2); 47 47 if(HaveSameText($Group, $DbRow2, $Value)) 48 48 { 49 49 if ($DbRow2['VersionEnd'] <> $BuildNumber) { 50 50 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']); 51 52 53 51 echo(', '); 52 } else 53 echo('. '); 54 54 } else 55 55 { … … 63 63 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 64 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.', 11);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 66 } 67 68 69 { 67 68 } else 69 { 70 70 // Insert new text 71 71 $Columns = 'entry, language, VersionStart, VersionEnd'; … … 79 79 echo('+ '); 80 80 $NewCount++; 81 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.', 11);82 83 84 85 } 86 81 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 83 } 84 $Count++; 85 } 86 echo('<br />Celkem: '.$Count.' Nových: '.$NewCount.'<br />'); 87 87 $Database->SQLCommand('UPDATE `group` SET LastVersion = "'.$BuildNumber.'", LastImport = NOW() WHERE Id='.$GroupId); 88 88 }
Note:
See TracChangeset
for help on using the changeset viewer.