1 | <?php
|
---|
2 |
|
---|
3 | ini_set('memory_limit', '100M');
|
---|
4 |
|
---|
5 | include_once('../../includes/Global.php');
|
---|
6 | //include_once('../../includes/dbc.php');
|
---|
7 | include_once('Export.php');
|
---|
8 | include_once('Page.php');
|
---|
9 |
|
---|
10 | $System = new Core();
|
---|
11 | $System->DoNotShowPage = true;
|
---|
12 | $System->Run();
|
---|
13 |
|
---|
14 | $Output = '';
|
---|
15 |
|
---|
16 | if (defined('STDIN') == false)
|
---|
17 | {
|
---|
18 | $Output = T('Access denied');
|
---|
19 | exit($Output);
|
---|
20 | }
|
---|
21 |
|
---|
22 | foreach ($_SERVER['argv'] as $parameter)
|
---|
23 | {
|
---|
24 | if (strpos($parameter, '=') !== false)
|
---|
25 | {
|
---|
26 | $index = substr($parameter, 0, strpos($parameter, '='));
|
---|
27 | $parameter = substr($parameter, strpos($parameter, '=') + 1);
|
---|
28 | //echo ($index.' ---- '.$parameter);
|
---|
29 | $_GET[$index] = $parameter;
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | echo 'Generuji Export:';
|
---|
34 | $Export = new Export($System);
|
---|
35 | if (!array_key_exists('AoWoWExportId', $Config)) {
|
---|
36 | $Export->Id = $Config['AoWoWExportId'];
|
---|
37 | } else $Export->Id = 37;
|
---|
38 | $Output .= $Export->Init();
|
---|
39 | $SQL = $Export->ExportToAoWoWSQL();
|
---|
40 | echo 'Hotovo
|
---|
41 | ';
|
---|
42 | /*
|
---|
43 |
|
---|
44 | // Rebuild user selection
|
---|
45 | $UserSelection = array();
|
---|
46 | $DbResult = $System->Database->query('SELECT `ID`, `XP` FROM `User`');
|
---|
47 | while ($DbRow = $DbResult->fetch_assoc())
|
---|
48 | {
|
---|
49 | $UserSelection[$DbRow['ID']] = $DbRow['XP'];
|
---|
50 | }
|
---|
51 | arsort($UserSelection);
|
---|
52 |
|
---|
53 | // Update export user selection sequence
|
---|
54 | $Sequence = 1;
|
---|
55 | foreach ($UserSelection as $ID => $XP)
|
---|
56 | {
|
---|
57 | $DbResult = $System->Database->query('SELECT `Id` FROM `ExportUser` WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID);
|
---|
58 | if ($DbResult->num_rows > 0)
|
---|
59 | $Query = 'UPDATE `ExportUser` SET `Sequence` = '.$Sequence.' WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID;
|
---|
60 | else $Query = 'INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$Config['AoWoWExportId'].', '.$ID.', '.$Sequence.')';
|
---|
61 | $System->Database->query($Query);
|
---|
62 | $Sequence++;
|
---|
63 | }
|
---|
64 | */
|
---|
65 | echo 'Vkládám do AoWoW Databáze:
|
---|
66 | ';
|
---|
67 | // Import exported data
|
---|
68 | $SQL = explode("\n", $SQL);
|
---|
69 | $Database2 = new mysqli($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
|
---|
70 | $Database2->query('SET NAMES '.$Config['Database']['Charset']);
|
---|
71 | $Database2->select_db($Config['Database']['DatabaseAoWoW']);
|
---|
72 | foreach ($SQL as $Line)
|
---|
73 | {
|
---|
74 | //echo '.';
|
---|
75 | //echo($Line."\n");
|
---|
76 | if (trim($Line) != '') $Database2->query($Line);
|
---|
77 | }
|
---|
78 | echo 'Hotovo
|
---|
79 | ';
|
---|
80 |
|
---|
81 | echo 'Mažu dočasné soubory:
|
---|
82 | ';
|
---|
83 | // Delete temporary cache files
|
---|
84 | $Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos');
|
---|
85 | foreach ($Files as $File)
|
---|
86 | {
|
---|
87 | $End = substr($File, strlen($File) - 3);
|
---|
88 | if ($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File);
|
---|
89 | }
|
---|
90 | $Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead');
|
---|
91 | foreach ($Files as $File)
|
---|
92 | {
|
---|
93 | $End = substr($File, strlen($File) - 3);
|
---|
94 | if ($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File);
|
---|
95 | }
|
---|
96 | echo 'Hotovo
|
---|
97 | ';
|
---|
98 |
|
---|
99 | echo 'Aktualizuji záznam o změně:
|
---|
100 | ';
|
---|
101 | // Update news date
|
---|
102 | $Database2->query('UPDATE `aowow_news` SET `text_loc0` = "Poslední aktualizace dat '.date('d. n. Y, H:i:s').'", `text_loc8` = "Poslední aktualizace dat '.date('d. n. Y, H:i:s').'" WHERE `aowow_news`.`id` =3');
|
---|
103 | echo 'Hotovo
|
---|
104 | ';
|
---|
105 |
|
---|
106 |
|
---|
107 | $Output = str_replace('<br/>','
|
---|
108 | ',$Output);
|
---|
109 | $Output = str_replace('<br />','
|
---|
110 | ',$Output);
|
---|
111 | echo ($Output);
|
---|