Changeset 630 for trunk/Modules/Import/Import.php
- Timestamp:
- Dec 8, 2013, 6:43:40 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Import/Import.php
r578 r630 15 15 $this->License = 'GNU/GPL'; 16 16 $this->Description = 'Support for import of data.'; 17 $this->Dependencies = array(); 17 $this->Dependencies = array(); 18 18 } 19 19 … … 61 61 // Update existed text 62 62 $DbRow2 = $DbResult2->fetch_assoc(); 63 if($this->HaveSameText($this->Group, $DbRow2, $Value) )63 if($this->HaveSameText($this->Group, $DbRow2, $Value) ) 64 64 { 65 65 if($DbRow2['VersionEnd'] <> $this->Version['BuildNumber']) … … 69 69 } else echo('. '); 70 70 } else 71 { 72 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 73 $Values = $DbRow2['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber']; 74 foreach($this->Group['Items'] as $GroupItem) 75 { 76 $Columns .= ', `'.$GroupItem['Column'].'`'; 77 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 78 } 79 $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 80 echo('# '); 81 $InsertId = $this->System->Database->insert_id; 82 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&ID='.$InsertId.'">'.$InsertId.'</a> ('.$DbRow2['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' změněn.', LOG_TYPE_IMPORT); 71 { 72 if($DbRow2['VersionEnd'] <> $this->Version['BuildNumber']) { 73 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 74 $Values = $DbRow2['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber']; 75 foreach($this->Group['Items'] as $GroupItem) 76 { 77 $Columns .= ', `'.$GroupItem['Column'].'`'; 78 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 79 } 80 $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 81 echo('# '); 82 $InsertId = $this->System->Database->insert_id; 83 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&ID='.$InsertId.'">'.$InsertId.'</a> ('.$DbRow2['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' změněn.', LOG_TYPE_IMPORT); 84 } else echo('Allready imported '.$DbRow2['Entry'].' '); 83 85 } 84 86 } else … … 115 117 { 116 118 global $TranslationTree, $PatchVersion; 117 118 119 $Output = 'Načítání textů z LUA souboru...'; 120 119 121 if(($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != '')) 120 122 { 123 121 124 $Output .= '<br />'.$this->Group['Name'].'<br />'; 122 125 if($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1) 123 126 { 124 127 $File = new FileStream(); 125 $File->OpenFile('../source/'.$this->Version['Version'].'/lua/'.$this->Group['LuaFileName'].'.lua'); 128 129 $File->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/lua/'.$this->Group['LuaFileName'].'.lua'); 126 130 $this->NewItemCount = 0; 127 131 $Count = 0; … … 161 165 } else $Output .= ShowMessage('Není definováno jméno zdrojového souboru', MESSAGE_CRITICAL); 162 166 $Output .= ShowMessage('Dokončeno.'); 167 return ($Output); 163 168 } 164 169 … … 170 175 foreach($TranslationTree as $Group) 171 176 { 172 $Output .= '<br />'.$Group['Name'].' '; 177 $Output .= '<br />'.$Group['Name'].' '; 178 $do = true; 179 while($do) 180 { 173 181 $DbResult = $this->System->Database->query('SELECT `gs_tran`.`ID`, '. 174 182 '`gs_tran`.`VersionEnd` AS `VersionEnd_tran`, '. … … 177 185 '` AS `gs_orig` ON `gs_orig`.`ID` = `gs_tran`.`Take` WHERE '. 178 186 '`gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd`'); 179 while($DbRow = $DbResult->fetch_assoc()) 180 { 181 $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$DbRow['VersionEnd_orig'].' WHERE `ID` = '.$DbRow['ID']); 182 $Output .= '. '; 183 } 187 $do = ($DbResult->num_rows > 0); 188 while($DbRow = $DbResult->fetch_assoc()) 189 { 190 $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$DbRow['VersionEnd_orig'].' WHERE `ID` = '.$DbRow['ID']); 191 $Output .= '. '; 192 } 193 } 184 194 $Output .= '<strong>Dokončeno.</strong>'; 185 195 } … … 255 265 256 266 $DBCFile = new DBCFile(); 257 $DBCFile->OpenFile( '../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', $ColumnFormat);267 $DBCFile->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', $ColumnFormat); 258 268 $ItemCount = $DBCFile->GetRecordCount(); 259 269 $this->NewItemCount = 0; … … 305 315 $Output= ''; 306 316 $File = new FileStream(); 307 $File->OpenFile( '../source/'.$this->Version['Version'].'/sql/'.$this->Group['MangosTable'].'.sql');317 $File->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/sql/'.$this->Group['MangosTable'].'.sql'); 308 318 $this->NewItemCount = 0; 309 319 $Count = 0;
Note:
See TracChangeset
for help on using the changeset viewer.