Changeset 650 for trunk/Modules/Export/ProcessAoWoWExport.php
- Timestamp:
- Dec 14, 2013, 7:52:40 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/ProcessAoWoWExport.php
r647 r650 3 3 ini_set('memory_limit', '100M'); 4 4 5 $_SERVER['REMOTE_ADDR'] = 'localhost'; 6 $_SERVER['REQUEST_URI'] = '127.0.0.1'; 7 5 8 include_once('../../includes/global.php'); 6 9 //include_once('../../includes/dbc.php'); 7 10 include_once('Export.php'); 8 include_once(' ExportOutput.php');11 include_once('Page.php'); 9 12 10 LoadCommandLineParameters(); 13 $System = new System(); 14 $System->DoNotShowPage = true; 15 $System->Run(); 11 16 12 if(!array_key_exists('AoWoWExportId', $Config)) die('You have to specify ExportId in your config file.');17 $_SERVER['REQUEST_URI'] = __FILE__; 13 18 14 $Export = new Export($System); 15 $Export->Id = $Config['AoWoWExportId']; 19 $Output = ''; 20 21 if(defined('STDIN') == false) 22 { 23 $Output = T('Access denied'); 24 exit($Output); 25 } 26 27 foreach($_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 38 echo 'Generuji Export:'; 39 $Export = new Export($System); 40 if(!array_key_exists('AoWoWExportId', $Config)) { 41 $Export->Id = $Config['AoWoWExportId']; 42 } else $Export->Id = 37; 43 $Output .= $Export->Init(); 44 $SQL = $Export->ExportToAoWoWSQL(); 45 echo 'Hotovo 46 '; 47 /* 16 48 17 49 // Rebuild user selection … … 35 67 $Sequence++; 36 68 } 37 69 */ 70 echo 'Vkládám do AoWoW Databáze: 71 '; 38 72 // Import exported data 39 $SQL = $Export->ExportToAoWoWSQL();40 73 $SQL = explode("\n", $SQL); 41 74 $Database2 = new mysqli($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']); … … 44 77 foreach($SQL as $Line) 45 78 { 79 //echo '.'; 46 80 //echo($Line."\n"); 47 81 if(trim($Line) != '') $Database2->query($Line); 48 82 } 83 echo 'Hotovo 84 '; 49 85 86 echo 'Mažu dočasné soubory: 87 '; 50 88 // Delete temporary cache files 51 $Files = scandir( '../aowow/cache/mangos');89 $Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos'); 52 90 foreach($Files as $File) 53 91 { 54 92 $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); 56 94 } 57 $Files = scandir( '../aowow/cache/templates/wowhead');95 $Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead'); 58 96 foreach($Files as $File) 59 97 { 60 98 $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); 62 100 } 101 echo 'Hotovo 102 '; 63 103 104 echo 'Aktualizuji záznam o změně: 105 '; 64 106 // Update news date 65 107 $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'); 108 echo '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.