DoNotShowPage = true;
$System->Run();
$Output = '';
if (defined('STDIN') == false)
{
$Output = T('Access denied');
exit($Output);
}
foreach ($_SERVER['argv'] as $parameter)
{
if (strpos($parameter, '=') !== false)
{
$index = substr($parameter, 0, strpos($parameter, '='));
$parameter = substr($parameter, strpos($parameter, '=') + 1);
//echo ($index.' ---- '.$parameter);
$_GET[$index] = $parameter;
}
}
echo 'Generuji Export:';
$Export = new Export($System);
if (!array_key_exists('AoWoWExportId', $Config)) {
$Export->Id = $Config['AoWoWExportId'];
} else $Export->Id = 37;
$Output .= $Export->Init();
$SQL = $Export->ExportToAoWoWSQL();
echo 'Hotovo
';
/*
// Rebuild user selection
$UserSelection = array();
$DbResult = $System->Database->query('SELECT `ID`, `XP` FROM `User`');
while ($DbRow = $DbResult->fetch_assoc())
{
$UserSelection[$DbRow['ID']] = $DbRow['XP'];
}
arsort($UserSelection);
// Update export user selection sequence
$Sequence = 1;
foreach ($UserSelection as $ID => $XP)
{
$DbResult = $System->Database->query('SELECT `Id` FROM `ExportUser` WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID);
if ($DbResult->num_rows > 0)
$Query = 'UPDATE `ExportUser` SET `Sequence` = '.$Sequence.' WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID;
else $Query = 'INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$Config['AoWoWExportId'].', '.$ID.', '.$Sequence.')';
$System->Database->query($Query);
$Sequence++;
}
*/
echo 'Vkládám do AoWoW Databáze:
';
// Import exported data
$SQL = explode("\n", $SQL);
$Database2 = new mysqli($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
$Database2->query('SET NAMES '.$Config['Database']['Charset']);
$Database2->select_db($Config['Database']['DatabaseAoWoW']);
foreach ($SQL as $Line)
{
//echo '.';
//echo($Line."\n");
if (trim($Line) != '') $Database2->query($Line);
}
echo 'Hotovo
';
echo 'Mažu dočasné soubory:
';
// Delete temporary cache files
$Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos');
foreach ($Files as $File)
{
$End = substr($File, strlen($File) - 3);
if ($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File);
}
$Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead');
foreach ($Files as $File)
{
$End = substr($File, strlen($File) - 3);
if ($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File);
}
echo 'Hotovo
';
echo 'Aktualizuji záznam o změně:
';
// Update news date
$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');
echo 'Hotovo
';
$Output = str_replace('
','
',$Output);
$Output = str_replace('
','
',$Output);
echo ($Output);