Changeset 93 for trunk/www/Application/Model/Server.php
- Timestamp:
- Aug 15, 2013, 11:17:26 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/Application/Model/Server.php
r78 r93 9 9 var $Task; 10 10 11 function __construct($ Database, $Id)12 { 13 $this->Database = $Database;14 $this->Task = new Task($ Database);11 function __construct($System, $Id) 12 { 13 parent::__construct($System); 14 $this->Task = new Task($System); 15 15 $this->Id = $Id; 16 16 $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id); … … 68 68 function GetState() 69 69 { 70 global $System;71 72 70 $State = array(); 73 $State['RealmdPortState'] = $ System->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']);71 $State['RealmdPortState'] = $this->System->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']); 74 72 $State['Online'] = $State['RealmdPortState']; 75 73 $DbResult = $this->Database->query('SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = "server'.$this->Id.'_realmd"'); … … 97 95 function UpdateRealmlist() 98 96 { 99 global $Config;100 101 97 $this->Database->query('TRUNCATE TABLE server'.$this->Id.'_realmd.realmlist'); 102 98 $DbResult = $this->Database->select('Realm', '*', 'Server = '.$this->Id); 103 99 while($Realm = $DbResult->fetch_assoc()) 104 100 { 105 $this->Database->insert('server'.$this->Id.'_realmd`.`realmlist', array('id' => $Realm['Id'], 'name' => addslashes($Realm['Name']), 'address' => $Config['Web']['Host'], 'port' => $Realm['NetworkPortWorldd'], 'icon' => 0, 'timezone' => 1, 'color' => 0)); 101 $this->Database->insert('server'.$this->Id.'_realmd`.`realmlist', 102 array('id' => $Realm['Id'], 'name' => addslashes($Realm['Name']), 103 'address' => $this->Config['Web']['Host'], 'port' => $Realm['NetworkPortWorldd'], 104 'icon' => 0, 'timezone' => 1, 'color' => 0)); 106 105 } 107 106 } … … 116 115 function UpdateScripts() 117 116 { 118 global $Config;119 120 117 $ServerBinDir = '../server/'.$this->Id.'/bin/'; 121 118 if(!file_exists($ServerBinDir)) mkdir($ServerBinDir, 0777, true); … … 147 144 function SetupConfigurationFiles() 148 145 { 149 global $Config;150 151 146 $EmulatorEtcDir = '../emulator/'.$this->Server['Database']['Emulator']['Id'].'/etc/'; 152 147 $ServerEtcDir = '../server/'.$this->Id.'/etc/'; … … 156 151 157 152 // realmd.conf 158 $EmulatorConfig = new MangosConfigurationFile($this-> Database);153 $EmulatorConfig = new MangosConfigurationFile($this->System); 159 154 $EmulatorConfig->Load($EmulatorEtcDir.'realmd.conf.dist'); 160 155 $EmulatorConfig->ParameterList['LoginDatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';server'.$this->Id.'_realmd'; … … 178 173 while($DbRow = $DbResult->fetch_assoc()) 179 174 { 180 $Server = new Server($this-> Database, $DbRow['Id']);175 $Server = new Server($this->System, $DbRow['Id']); 181 176 $Server->UpdateState(); 182 177 } … … 249 244 if($DoBackup) 250 245 { 251 $Backup = new Backup($this-> Database, 0);246 $Backup = new Backup($this->System, 0); 252 247 $Output .= '<br />'.$Backup->Create($this->Id); 253 248 } … … 308 303 while($DbRow = $DbResult->fetch_assoc()) 309 304 { 310 $Realm = new Realm($this-> Database, $DbRow['Id']);305 $Realm = new Realm($this->System, $DbRow['Id']); 311 306 $UsedMemory += $Realm->GetUsedMemory(); 312 307 } … … 335 330 function UpdateRealmlistAccountCount() 336 331 { 337 global $Config;338 339 332 $this->Database->query('TRUNCATE TABLE server'.$this->Id.'_realmd.realmcharacters'); 340 333 $DbResult = $this->Database->select('Realm', '*', 'Server = '.$this->Id); … … 345 338 } 346 339 } 347 348 ?>
Note:
See TracChangeset
for help on using the changeset viewer.