source: trunk/Modules/Import/Import.php

Last change on this file was 894, checked in by chronos, 21 months ago
  • Fixed: Export error due to PHP 8.1 deprecated code.
  • Modified: Code cleanup.
File size: 21.0 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/../../includes/dbc.php');
4include_once(dirname(__FILE__).'/Manage.php');
5
6class ModuleImport extends Module
7{
8 function __construct(System $System)
9 {
10 parent::__construct($System);
11 $this->Name = 'Import';
12 $this->Version = '1.0';
13 $this->Creator = 'Chronos';
14 $this->License = 'GNU/GPL';
15 $this->Description = 'Support for import of data.';
16 $this->Dependencies = array('Translation');
17 }
18
19 function DoStart(): void
20 {
21 $this->System->RegisterPage(['import'], 'PageImport');
22 }
23}
24
25class Import
26{
27 var $Version;
28 var $Group;
29 var $NewItemCount;
30 var $System;
31
32 function __construct(System $System)
33 {
34 $this->System = &$System;
35 }
36
37 function SetVersion($Version)
38 {
39 $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion` WHERE `Version` = "'.$Version.'"');
40 $this->Version = $DbResult->fetch_assoc();
41 }
42
43 function InsertItem($Value)
44 {
45 $insert = true;
46 $Columns = '';
47 //$Values = '';
48 foreach ($this->Group['Items'] as $GroupItem)
49 {
50 $Columns .= ', `'.$GroupItem['Column'].'` ';
51 // $Values .= ', "'.$Value[$GroupItem['Column']].'"';
52 }
53 $Columns = substr($Columns, 1);
54 $Where = ' (`'.$this->Group['PrimaryKeyItem'].'` = "'.$Value[$this->Group['PrimaryKeyItem']].'") AND (`Language`=0) ' ;
55
56 $DbResultMiddle = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` <= '.$this->Version['BuildNumber'].' AND `VersionEnd` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1');
57 $DbResultBefore = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionEnd` <= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1');
58 $DbResultAfter = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionStart` LIMIT 1');
59
60 if (($DbResultMiddle->num_rows > 0) or ($DbResultBefore->num_rows > 0) or ($DbResultAfter->num_rows > 0))
61 {
62 // Update existed text
63 $DbRowMiddle = $DbResultMiddle->fetch_assoc();
64 $DbRowAfter = $DbResultAfter->fetch_assoc();
65 $DbRowBefore = $DbResultBefore->fetch_assoc();
66
67 if ($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0))
68 {
69 $insert = false;
70 if ($this->Group['Id'] == 1)
71 {
72 $set = ' , EndText = "'.$Value['EndText'].'" , ObjectiveText1 = "'.$Value['ObjectiveText1'].'"'.' , ObjectiveText2 = "'.$Value['ObjectiveText2'].'"'.' , ObjectiveText3 = "'.$Value['ObjectiveText3'].'"'.' , ObjectiveText4 = "'.$Value['ObjectiveText4'].'"';
73 } else $set = '';
74 $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionEnd` = "'.$this->Version['BuildNumber'].'" '.$set.' WHERE `ID`='.$DbRowBefore['ID']);
75 echo('b ');
76
77 } else
78 if ($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0))
79 {
80 $insert = false;
81 if ($this->Group['Id'] == 1)
82 {
83 $set = ' , EndText = "'.$Value['EndText'].'" , ObjectiveText1 = "'.$Value['ObjectiveText1'].'"'.' , ObjectiveText2 = "'.$Value['ObjectiveText2'].'"'.' , ObjectiveText3 = "'.$Value['ObjectiveText3'].'"'.' , ObjectiveText4 = "'.$Value['ObjectiveText4'].'"';
84 } else $set = '';
85 $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionStart` = "'.$this->Version['BuildNumber'].'" '.$set.' WHERE `ID`='.$DbRowAfter['ID']);
86 echo('a ');
87 } else
88 {
89 if (isset($DbRowAfter['VersionStart']))
90 {
91 if ($DbRowAfter['VersionStart'] <= $this->Version['BuildNumber'])
92 {
93 echo('Allready imported '.$DbRowBefore['Entry'].' ');
94 $insert = false;
95 }
96 }
97 if (isset($DbRowBefore['VersionEnd']))
98 {
99 if ($DbRowBefore['VersionEnd'] >= $this->Version['BuildNumber'])
100 {
101 echo('Allready imported '.$DbRowBefore['Entry'].' ');
102 $inserted = false;
103 }
104 }
105
106 // if [DEPRECATED] do not import
107 foreach ($this->Group['Items'] as $GroupItem)
108 {
109 if (false !== strpos($Value[$GroupItem['Column']],'[DEPRECATED'))
110 {
111 echo('d '.$DbRowBefore['Entry'].' ');
112 $insert = false;
113 }
114 }
115
116 if ($insert)
117 {
118 $insert = false;
119 foreach ($this->Group['Items'] as $GroupItem)
120 {
121 if ($Value[$GroupItem['Column']] <> '') $insert = true;
122 }
123 }
124
125 if (isset($DbRowMiddle['Entry'])) $insert = false;
126 if (isset($DbRowAfter['Entry'])) $Value['Entry'] = $DbRowAfter['Entry'];
127 if (isset($DbRowBefore['Entry'])) $Value['Entry'] = $DbRowBefore['Entry'];
128
129 if ($insert)
130 {
131 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
132 $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber'];
133 foreach ($this->Group['Items'] as $GroupItem)
134 {
135 $Columns .= ', `'.$GroupItem['Column'].'`';
136 $Values .= ', "'.$Value[$GroupItem['Column']].'"';
137 }
138 $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
139
140 echo('
141 '.$Value['Entry'].' = '.$DbRowBefore['VersionStart'].'.'.$DbRowBefore['VersionEnd'].'< '.$this->Version['BuildNumber'].' <'.$DbRowAfter['VersionStart'].'.'.$DbRowAfter['VersionEnd'].'... '.$DbRowMiddle['VersionStart'].' '.$DbRowMiddle['VersionEnd'].'
142 ');
143
144 if (false !== strpos($Values,'[DEPRECATED'))
145 echo($Values);
146
147 echo('# ');
148 $InsertId = $this->System->Database->insert_id;
149 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.$InsertId.'">'.$InsertId.'</a> ('.$Value['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' změněn.', LOG_TYPE_IMPORT);
150 }
151 }
152 } else
153 {
154 // Insert new text
155 if (is_numeric($Value[$this->Group['PrimaryKeyItem']])) $Value['Entry'] = $Value[$this->Group['PrimaryKeyItem']];
156 else
157 {
158 // Get new unused Entry for tables without numeric id
159 $Value['Entry'] = 1;
160 $DbResult = $this->System->Database->query('SELECT MAX(`Entry`) FROM `'.$this->Group['TablePrefix'].'`');
161 if ($DbResult->num_rows > 0)
162 {
163 $DbRow = $DbResult->fetch_row();
164 $Value['Entry'] += $DbRow[0];
165 }
166 }
167 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
168 $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber'];
169 $insert = false;
170 foreach ($this->Group['Items'] as $GroupItem)
171 {
172 $Columns .= ', `'.$GroupItem['Column'].'`';
173 $Values .= ', "'.$Value[$GroupItem['Column']].'"';
174 if ($Value[$GroupItem['Column']] <> '') $insert = true;
175 }
176 if ($insert)
177 {
178 $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
179 $InsertId = $this->System->Database->insert_id;
180 echo('+ ');
181 $this->NewItemCount++;
182 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.$InsertId.'">'.$InsertId.'</a> ('.$Value['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' přidán.', LOG_TYPE_IMPORT);
183 }
184 }
185 }
186
187 function ImportLUA()
188 {
189 $Output = 'Načítání textů z LUA souboru...';
190
191 if (($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != ''))
192 {
193 $Output .= '<br />'.$this->Group['Name'].'<br />';
194 // if ($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1)
195 {
196 $File = new FileStream();
197
198 $File->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/lua/'.$this->Group['LuaFileName'].'.lua');
199 $this->NewItemCount = 0;
200 $Count = 0;
201 while (!$File->EOF())
202 {
203 $Line = $File->ReadLine();
204 if (strpos($Line, '=') !== false)
205 {
206 $LineParts = explode('=', $Line, 2);
207 $Value['ShortCut'] = trim($LineParts[0]);
208 $Line = trim($LineParts[1]);
209 if ($Line[0] == '"')
210 {
211 // Quoted string value
212 $Line = substr($Line, 1); // Skip start qoute
213 $TempLine = str_replace('\"', ' ', $Line); // Temporary remove slashed quotes
214 $Value['Text'] = substr($Line, 0, strpos($TempLine, '"'));
215 $Value['Text'] = str_replace('\n', "\n", $Value['Text']);
216 $Value['Text'] = addslashes(stripslashes($Value['Text']));
217 $Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon
218 } else
219 {
220 // Nonstring value
221 $Value['Text'] = substr($Line, 0, strpos($Line, ';'));
222 }
223 $Line = substr($Line, strpos($Line, ';') + 1);
224 $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --"
225
226 $this->InsertItem($Value);
227 };
228 $Count++;
229 }
230 $Output .= '<br />Celkem: '.$Count.' Nových: '.$this->NewItemCount.'<br />';
231 $this->UpdateLastVersion();
232 }
233 // else $Output .= ShowMessage('Již importován pro verzi '.$this->Version['Version'], MESSAGE_CRITICAL);
234 } else $Output .= ShowMessage('Není definováno jméno zdrojového souboru', MESSAGE_CRITICAL);
235 $Output .= ShowMessage('Dokončeno.');
236 return $Output;
237 }
238
239 function UpdateTranslated()
240 {
241 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
242 $Output = '<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />';
243 foreach ($TranslationTree as $Group)
244 {
245 $Output .= '<br />'.$Group['Name'].' ';
246 $do = true;
247 while ($do)
248 {
249 $DbResult = $this->System->Database->query('SELECT `gs_tran`.`ID`, '.
250 '`gs_tran`.`VersionEnd` AS `VersionEnd_tran`, '.
251 '`gs_tran`.`VersionStart` AS `VersionStart_tran`, '.
252 '`gs_orig`.`VersionEnd` AS `VersionEnd_orig`, '.
253 '`gs_orig`.`VersionStart` AS `VersionStart_orig` FROM `'.
254 $Group['TablePrefix'].'` AS `gs_tran` JOIN `'.$Group['TablePrefix'].
255 '` AS `gs_orig` ON `gs_orig`.`ID` = `gs_tran`.`Take` WHERE '.
256 '`gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd` OR `gs_tran`.`VersionStart` <> `gs_orig`.`VersionStart`');
257 $do = ($DbResult->num_rows > 0);
258 while ($DbRow = $DbResult->fetch_assoc())
259 {
260 echo('`');
261 $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$DbRow['VersionEnd_orig'].', `VersionStart` = '.$DbRow['VersionStart_orig'].' WHERE `ID` = '.$DbRow['ID']);
262 $Output .= '. ';
263 }
264 }
265 $Output .= '<strong>Dokončeno.</strong>';
266 }
267 return $Output;
268 }
269
270 function HaveSameText($Group, $DbRow2, $Value)
271 {
272 $result = true;
273 foreach ($Group['Items'] as $GroupItem)
274 {
275 $old = $DbRow2[$GroupItem['Column']];
276 $old = str_replace(chr(10), '', $old);
277 $old = str_replace(chr(13), '', $old);
278 $old = str_replace('\n', '', $old);
279 $old = str_replace('\r', '', $old);
280 $old = str_replace('\"', '"', $old);
281 $old = str_replace('\\\\', '\\', $old);
282 $old = str_replace('\32', '32', $old);
283 $old = str_replace('\124', '124', $old);
284 $old = str_replace("\'", "'", $old);
285 $old = str_replace("Â", "", $old);
286 $old = str_replace("�", "", $old);
287 $old = str_replace('-', '', $old);
288 $old = str_replace(' ', '', $old);
289 $old = strtolower($old);
290 $old = str_replace('$b', '', $old);
291
292 if ($this->Group['Id'] == 1)
293 {
294 while ($part = substr($old, strpos($old, '<'), strpos($old, '>')-strpos($old, '<')))
295 {
296 if ($part <> '')
297 {
298 $old = str_replace($part.'>', '', $old);
299 }
300 }
301 }
302
303 if (($GroupItem['MangosColumn'] <> '') and ($Group['MangosDatabase'] == 'mangos'))
304 $new = $Value[$GroupItem['MangosColumn']];
305 else $new = $Value[$GroupItem['Column']];
306
307 $new = str_replace(chr(10), '', $new);
308 $new = str_replace(chr(13), '', $new);
309 $new = str_replace('\n', '', $new);
310 $new = str_replace('\r', '', $new);
311 $new = str_replace('\"', '"', $new);
312 $new = str_replace('\\\\', '\\', $new);
313 $new = str_replace('\32', '32', $new);
314 $new = str_replace('\124', '124', $new);
315 $new = str_replace("\'", "'", $new);
316 $new = str_replace("Â", "", $new);
317 $new = str_replace("�", "", $new);
318 $new = str_replace('-', '', $new);
319 $new = str_replace(' ', '', $new);
320 $new = strtolower($new);
321 $new = str_replace('$b', '', $new);
322
323 if ($this->Group['Id'] == 1)
324 {
325 while ($part = substr($new, strpos($new, '<'), strpos($new, '>')-strpos($new, '<')))
326 {
327 if ($part <> '')
328 {
329 $new = str_replace($part.'>', '', $new);
330 }
331 }
332 }
333
334 if (($old == 'null') or ($old == 'NULL')) $old = '';
335 if (($new == 'null') or ($new == 'NULL')) $new = '';
336
337 if (($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment'))
338 {
339 // echo $old.'X'.$new;
340 if ( ($GroupItem['Column'] <> 'EndText')
341 and ($GroupItem['Column'] <> 'ObjectiveText1')
342 and ($GroupItem['Column'] <> 'ObjectiveText2')
343 and ($GroupItem['Column'] <> 'ObjectiveText3')
344 and ($GroupItem['Column'] <> 'ObjectiveText4') )
345 $result = false;
346 }
347 }
348
349 return $result;
350 }
351
352 function ImportDBC()
353 {
354 global $System;
355
356 $Output = 'Načítání textů z DBC souboru...';
357 if (($this->Group['DBCFileName'] != '') and ($this->Group['TablePrefix'] != ''))
358 {
359 $Output .= '<br />'.$this->Group['Name'].'<br />';
360
361 // Load string column index list
362 $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']);
363
364 $ColumnIndexes = array();
365 $ColumnFormat = array();
366 while ($DbRow = $DbResult->fetch_assoc())
367 {
368 $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING;
369 $ColumnIndexes[$DbRow['GroupItem']] = $DbRow['ColumnIndex'];
370 }
371
372 $DBCFile = new DBCFile();
373 $DBCFile->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', $ColumnFormat);
374 $ItemCount = $DBCFile->GetRecordCount();
375 $this->NewItemCount = 0;
376 $Count = 0;
377
378 for ($I = 0; $I < $ItemCount; $I++)
379 {
380 foreach ($this->Group['Items'] as $GroupItem)
381 if (array_key_exists($GroupItem['Id'], $ColumnIndexes))
382 {
383 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']]));
384 }
385
386 // Get multicolumn value
387 $Columns = explode(',', $this->Group['DBCIndex']);
388 $ColumnValue = '';
389 foreach ($Columns as $Column)
390 {
391 $ColumnValue .= '_'.$DBCFile->GetUint($I, $Column);
392 }
393 $ColumnValue = substr($ColumnValue, 1);
394 $Value[$this->Group['PrimaryKeyItem']] = $ColumnValue;
395 $this->InsertItem($Value);
396 $Count++;
397 }
398 $Output .= '<br />Celkem: '.$Count.' Nových: '.$this->NewItemCount.'<br />';
399 $this->UpdateLastVersion();
400 }
401 $Output .= '<strong>Dokončeno.</strong>';
402 return $Output;
403 }
404
405 function ImportGroup($GroupId)
406 {
407 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
408
409 $this->Group = $TranslationTree[$GroupId];
410
411 if ($this->Group['SourceType'] == 'dbc') $Output = $this->ImportDBC();
412 else if ($this->Group['SourceType'] == 'sql') $Output = $this->ImportSQL();
413 else if ($this->Group['SourceType'] == 'lua') $Output = $this->ImportLUA();
414 else $Output = ShowMessage('Neznámý typ zdroje pro import', MESSAGE_CRITICAL);
415 $Output .= $this->UpdateTranslated();
416 return $Output;
417 }
418
419 function ImportSQL()
420 {
421 $Output = '';
422 $File = new FileStream();
423 $File->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/sql/'.$this->Group['MangosTable'].'.sql');
424 $this->NewItemCount = 0;
425 $Count = 0;
426 $FollowStructure = false;
427 $i = 0;
428 while ((!$File->EOF()))
429 {
430 $Line = $File->ReadLine();
431 // Struktura
432 if (strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false)
433 {
434 $Line = '';
435 $FollowStructure = true;
436 $i = 0;
437 }
438 if ((strpos($Line, ';') !== false) and ($FollowStructure == true))
439 {
440 $FollowStructure = false;
441 }
442 if (($FollowStructure == true) and ($Line != ''))
443 {
444 $str = substr($Line, 0, strpos($Line, '`'));
445 $Line = substr($Line, strpos($Line, '`') + 1);
446 $Line = substr($Line, 0, strpos($Line, '`'));
447 if (strlen($str) < 3) $structure[$i] = $Line;
448 $i++;
449 }
450
451 // data
452 if ((strpos($Line, 'INSERT INTO `'.$this->Group['MangosTable'].'`') !== false) and (isset($structure)))
453 {
454 while ((strpos($Line, ');') === false) or ($File->EOF()))
455 $Line = $Line.$File->ReadLine();
456 $Line = str_replace("),\n(", '),(', $Line);
457
458 $Line = substr($Line, strpos($Line, '(') + 1);
459 $Line = substr($Line, 0, strpos($Line, ');'));
460 $LineParts = explode('),(', $Line);
461
462 unset($Line);
463
464 $value_buff = '';
465 $Value = '';
466 foreach ($LineParts as $LinePart)
467 {
468
469 unset($Value, $value_buff);
470 foreach ($structure as $i => $column)
471 {
472 if (substr($LinePart, 0, 1) != "'")
473 {
474 $value_buff = substr($LinePart, 0, strpos($LinePart, ','));
475 $LinePart = substr($LinePart, strlen($value_buff) + 1);
476 } else
477 {
478 $LinePart = substr($LinePart, 1);
479 $value_buff = substr($LinePart, 0, strpos($LinePart, "'"));
480 while (substr($value_buff, strlen($value_buff) - 1, 1) == "\\")
481 {
482 $str = substr($LinePart, strlen($value_buff));
483 $str2 = substr($str, 0, strpos($str, "'", 1));
484 $value_buff = $value_buff.$str2;
485 $str = substr($str, strlen($str2));
486 }
487 $LinePart = substr($LinePart, strlen($value_buff) + 2);
488 }
489 if (($value_buff != 'null') and ($value_buff != 'NULL'))
490 {
491 $str = '';
492 while (substr($value_buff, strlen($value_buff) - 1,1) == " ")
493 {
494 $value_buff = substr($value_buff, 0, strlen($value_buff) - 1);
495 $str .= ' ';
496 }
497 $str2 = '';
498 while (substr($value_buff, 0, 1) == ' ')
499 {
500 $value_buff = substr($value_buff, 1, strlen($value_buff) - 1);
501 $str2 .= ' ';
502 }
503 $Value[$column] = $str2.trim($value_buff).$str;
504 } else
505 {
506 $Value[$column] = '';
507 }
508 }
509 foreach ($this->Group['Items'] as $GroupItem)
510 {
511 if ($GroupItem['MangosColumn'] != '')
512 {
513 if (isset($Value[$GroupItem['MangosColumn']]))
514 {
515 $Value[$GroupItem['Column']] = $Value[$GroupItem['MangosColumn']];
516 }
517 else
518 {
519 $Value[$GroupItem['Column']] = '';
520 $Value[$GroupItem['MangosColumn']] ='';
521 }
522 }
523 }
524
525 // Get multicolumn value
526 $Columns = explode(',', $this->Group['MangosTableIndex']);
527 $ColumnValue = '';
528 foreach ($Columns as $Column)
529 {
530 $ColumnValue .= '_'.$Value[$Column];
531 }
532 $ColumnValue = substr($ColumnValue, 1);
533 $Value[$this->Group['PrimaryKeyItem']] = $ColumnValue;
534 $this->InsertItem($Value);
535 $Count++;
536 }
537 }
538 }
539 $Output = '<br />Celkem: '.$Count.' Nových: '.$this->NewItemCount.'<br />';
540 $this->UpdateLastVersion();
541 return $Output;
542 }
543
544 function UpdateLastVersion()
545 {
546 $DbResult = $this->System->Database->query('SELECT * FROM `Group` WHERE `Id`='.$this->Group['Id']);
547 $Version = $DbResult->fetch_assoc();
548 if ($Version['LastVersion'] < $this->Version['BuildNumber'])
549 $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
550 }
551}
Note: See TracBrowser for help on using the repository browser.