Ignore:
Timestamp:
Dec 14, 2013, 7:52:40 PM (11 years ago)
Author:
maron
Message:
  • Fixed: aowow update
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/ProcessAoWoWExport.php

    r647 r650  
    33ini_set('memory_limit', '100M');
    44
     5$_SERVER['REMOTE_ADDR'] = 'localhost';
     6$_SERVER['REQUEST_URI'] = '127.0.0.1';
     7
    58include_once('../../includes/global.php');
    69//include_once('../../includes/dbc.php');
    710include_once('Export.php');   
    8 include_once('ExportOutput.php');   
     11include_once('Page.php');   
    912
    10 LoadCommandLineParameters();
     13  $System = new System();
     14  $System->DoNotShowPage = true;
     15        $System->Run();
    1116
    12 if(!array_key_exists('AoWoWExportId', $Config)) die('You have to specify ExportId in your config file.');
     17$_SERVER['REQUEST_URI'] = __FILE__;
    1318
    14 $Export = new Export($System);
    15 $Export->Id = $Config['AoWoWExportId'];
     19$Output = '';
     20
     21if(defined('STDIN') == false)
     22{
     23  $Output = T('Access denied');
     24  exit($Output);
     25}
     26
     27foreach($_SERVER['argv'] as $parameter)
     28{
     29  if(strpos($parameter, '=') !== false)
     30  {
     31    $index = substr($parameter, 0, strpos($parameter, '='));
     32    $parameter = substr($parameter, strpos($parameter, '=') + 1);
     33    //echo ($index.'  ----  '.$parameter);
     34    $_GET[$index] = $parameter;
     35  }
     36}
     37
     38echo 'Generuji Export:';
     39  $Export = new Export($System);
     40if(!array_key_exists('AoWoWExportId', $Config)) {
     41  $Export->Id = $Config['AoWoWExportId'];
     42} else $Export->Id = 37;
     43  $Output .= $Export->Init();                   
     44  $SQL = $Export->ExportToAoWoWSQL();
     45echo 'Hotovo
     46';
     47/*
    1648
    1749// Rebuild user selection
     
    3567  $Sequence++;
    3668}
    37 
     69*/
     70echo 'Vkládám do AoWoW Databáze:
     71';
    3872// Import exported data
    39 $SQL = $Export->ExportToAoWoWSQL();
    4073$SQL = explode("\n", $SQL);
    4174$Database2 = new mysqli($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
     
    4477foreach($SQL as $Line)
    4578{
     79//echo '.';
    4680  //echo($Line."\n");
    4781  if(trim($Line) != '') $Database2->query($Line);
    4882}
     83echo 'Hotovo
     84';
    4985
     86echo 'Mažu dočasné soubory:
     87';
    5088// Delete temporary cache files
    51 $Files = scandir('../aowow/cache/mangos');
     89$Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos');
    5290foreach($Files as $File)
    5391{
    5492  $End = substr($File, strlen($File) - 3);
    55   if($End == 'aww') unlink('../aowow/cache/mangos/'.$File);
     93  if($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File);
    5694}
    57 $Files = scandir('../aowow/cache/templates/wowhead');
     95$Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead');
    5896foreach($Files as $File)
    5997{
    6098  $End = substr($File, strlen($File) - 3);
    61   if($End == 'php') unlink('../aowow/cache/templates/wowhead/'.$File);
     99  if($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File);
    62100}
     101echo 'Hotovo
     102';
    63103
     104echo 'Aktualizuji záznam o změně:
     105';
    64106// Update news date
    65107$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');
     108echo 'Hotovo
     109';
     110
     111
     112  $Output = str_replace('<br/>','
     113',$Output);
     114  $Output = str_replace('<br />','
     115',$Output);
     116 echo ($Output);
Note: See TracChangeset for help on using the changeset viewer.