Changeset 38 for trunk/www/shell.php
- Timestamp:
- Jun 16, 2009, 5:26:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/shell.php
r36 r38 3 3 include('global.php'); 4 4 5 $Output = ''; 6 if(count($_SERVER['argv']) > 1) 5 class Shell extends Module 7 6 { 8 $Command = $_SERVER['argv'][1]; 9 if($Command == 'ServerProcessLog') 7 var $Database; 8 9 function __construct($Database) 10 10 { 11 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 11 $this->Database = $Database; 12 } 13 14 function HistoryUpdate() 15 { 16 $DbResult = $this->Database->query('SELECT Id FROM Server'); 17 while($Server = $DbResult->fetch_assoc()) 12 18 { 13 $MangosDebug = new MangosDebug($Database); 14 $Output = $MangosDebug->ProcessLog($_SERVER['argv'][2]); 15 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.'; 16 } else 17 if($Command == 'ServerLock') 19 $History = new History($this->Database, $Server['Id'], 1); 20 $Server = new Server($this->Database, $Server['Id']); 21 $History->AddValue($Server->GetUsedMemory()); 22 } 23 } 24 25 function Show() 18 26 { 19 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 27 $Output = ''; 28 if(count($_SERVER['argv']) > 1) 20 29 { 21 $Server = new Server($Database, $_SERVER['argv'][2]); 22 $Server->Lock(); 23 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.'; 24 } else 25 if($Command == 'ServerUnLock') 26 { 27 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 28 { 29 $Server = new Server($Database, $_SERVER['argv'][2]); 30 $Server->UnLock(); 31 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.'; 32 } else 33 if($Command == 'EmulatorLock') 34 { 35 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 36 { 37 $Emulator = new Emulator($Database, $_SERVER['argv'][2]); 38 $Emulator->Lock(); 39 } else $Output = 'Jako druhý parameter je nutno zadat Id emulátoru.'; 40 } else 41 if($Command == 'EmulatorUnLock') 42 { 43 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 44 { 45 $Emulator = new Emulator($Database, $_SERVER['argv'][2]); 46 $Emulator->UnLock(); 47 } else $Output = 'Jako druhý parameter je nutno zadat Id emulátoru.'; 48 } else 49 if($Command == 'BackupLock') 50 { 51 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 52 { 53 $Backup = new Backup($Database, $_SERVER['argv'][2]); 54 $Backup->Lock(); 55 } else $Output = 'Jako druhý parameter je nutno zadat Id zálohy.'; 56 } else 57 if($Command == 'BackupUnLock') 58 { 59 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 60 { 61 $Backup = new Backup($Database, $_SERVER['argv'][2]); 62 $Backup->UnLock(); 63 } else $Output = 'Jako druhý parameter je nutno zadat Id zálohy.'; 64 } else 65 if($Command == 'TaskProcess') 66 { 67 $Task = new Task($Database); 68 $Task->ProcessAllCycle(); 69 } else 70 if($Command == 'ServerDatabaseChange') 71 { 72 if((count($_SERVER['argv']) > 3) and is_numeric($_SERVER['argv'][2]) and is_numeric($_SERVER['argv'][3])) 73 { 74 $Server = new Server($Database, $_SERVER['argv'][2]); 75 $Server->ChangeDatabaseId($_SERVER['argv'][3]); 76 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru, jako třetí Id databáze.'; 77 } else 78 $Output = 'Neznámý příkaz '.$Command; 79 } else $Output = 'Jako první parameter je nutno zadat povel.'; 80 echo($Output); 30 $Command = $_SERVER['argv'][1]; 31 if($Command == 'ServerProcessLog') 32 { 33 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 34 { 35 $MangosDebug = new MangosDebug($this->Database); 36 $Output = $MangosDebug->ProcessLog($_SERVER['argv'][2]); 37 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.'; 38 } else 39 if($Command == 'ServerLock') 40 { 41 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 42 { 43 $Server = new Server($this->Database, $_SERVER['argv'][2]); 44 $Server->Lock(); 45 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.'; 46 } else 47 if($Command == 'ServerUnLock') 48 { 49 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 50 { 51 $Server = new Server($this->Database, $_SERVER['argv'][2]); 52 $Server->UnLock(); 53 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.'; 54 } else 55 if($Command == 'EmulatorLock') 56 { 57 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 58 { 59 $Emulator = new Emulator($this->Database, $_SERVER['argv'][2]); 60 $Emulator->Lock(); 61 } else $Output = 'Jako druhý parameter je nutno zadat Id emulátoru.'; 62 } else 63 if($Command == 'EmulatorUnLock') 64 { 65 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 66 { 67 $Emulator = new Emulator($this->Database, $_SERVER['argv'][2]); 68 $Emulator->UnLock(); 69 } else $Output = 'Jako druhý parameter je nutno zadat Id emulátoru.'; 70 } else 71 if($Command == 'BackupLock') 72 { 73 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 74 { 75 $Backup = new Backup($this->Database, $_SERVER['argv'][2]); 76 $Backup->Lock(); 77 } else $Output = 'Jako druhý parameter je nutno zadat Id zálohy.'; 78 } else 79 if($Command == 'BackupUnLock') 80 { 81 if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2])) 82 { 83 $Backup = new Backup($this->Database, $_SERVER['argv'][2]); 84 $Backup->UnLock(); 85 } else $Output = 'Jako druhý parameter je nutno zadat Id zálohy.'; 86 } else 87 if($Command == 'TaskProcess') 88 { 89 $Task = new Task($this->Database); 90 $Task->ProcessAllCycle(); 91 } else 92 if($Command == 'HistoryUpdate') 93 { 94 $this->HistoryUpdate(); 95 } else 96 if($Command == 'ServerDatabaseChange') 97 { 98 if((count($_SERVER['argv']) > 3) and is_numeric($_SERVER['argv'][2]) and is_numeric($_SERVER['argv'][3])) 99 { 100 $Server = new Server($this->Database, $_SERVER['argv'][2]); 101 $Server->ChangeDatabaseId($_SERVER['argv'][3]); 102 } else $Output = 'Jako druhý parameter je nutno zadat Id serveru, jako třetí Id databáze.'; 103 } else 104 $Output = 'Neznámý příkaz '.$Command; 105 } else $Output = 'Jako první parameter je nutno zadat povel.'; 106 return($Output); 107 } 108 } 109 110 $Shell = new Shell($Database); 111 echo($Shell->Show()); 81 112 82 113 ?>
Note:
See TracChangeset
for help on using the changeset viewer.