Ignore:
Timestamp:
Aug 15, 2013, 11:17:26 PM (11 years ago)
Author:
chronos
Message:
  • Fixed: System variable as parameter to constructors of descendents of Module class.
  • Removed: End PHP mark "?>" from all files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/Application/Model/Server.php

    r78 r93  
    99  var $Task;
    1010 
    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);
    1515    $this->Id = $Id;
    1616    $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id);
     
    6868  function GetState()
    6969  {
    70     global $System;
    71    
    7270    $State = array();
    73     $State['RealmdPortState'] = $System->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']);
     71    $State['RealmdPortState'] = $this->System->NetworkPortState('localhost', $this->Server['NetworkPortRealmd']);
    7472    $State['Online'] = $State['RealmdPortState'];
    7573    $DbResult = $this->Database->query('SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = "server'.$this->Id.'_realmd"');
     
    9795  function UpdateRealmlist()
    9896  {
    99     global $Config;
    100    
    10197    $this->Database->query('TRUNCATE TABLE server'.$this->Id.'_realmd.realmlist');
    10298    $DbResult = $this->Database->select('Realm', '*', 'Server = '.$this->Id);
    10399    while($Realm = $DbResult->fetch_assoc())
    104100    {
    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));
    106105    }
    107106  }
     
    116115  function UpdateScripts()
    117116  {
    118     global $Config;
    119    
    120117    $ServerBinDir = '../server/'.$this->Id.'/bin/';
    121118    if(!file_exists($ServerBinDir)) mkdir($ServerBinDir, 0777, true);       
     
    147144  function SetupConfigurationFiles()
    148145  {
    149     global $Config;
    150    
    151146    $EmulatorEtcDir = '../emulator/'.$this->Server['Database']['Emulator']['Id'].'/etc/';
    152147    $ServerEtcDir = '../server/'.$this->Id.'/etc/';
     
    156151   
    157152    // realmd.conf
    158     $EmulatorConfig = new MangosConfigurationFile($this->Database);
     153    $EmulatorConfig = new MangosConfigurationFile($this->System);
    159154    $EmulatorConfig->Load($EmulatorEtcDir.'realmd.conf.dist');
    160155    $EmulatorConfig->ParameterList['LoginDatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';server'.$this->Id.'_realmd';
     
    178173    while($DbRow = $DbResult->fetch_assoc())
    179174    {
    180       $Server = new Server($this->Database, $DbRow['Id']);
     175      $Server = new Server($this->System, $DbRow['Id']);
    181176      $Server->UpdateState();
    182177    }   
     
    249244    if($DoBackup)
    250245    {
    251       $Backup = new Backup($this->Database, 0);
     246      $Backup = new Backup($this->System, 0);
    252247      $Output .= '<br />'.$Backup->Create($this->Id);
    253248    }
     
    308303    while($DbRow = $DbResult->fetch_assoc())
    309304    {
    310       $Realm = new Realm($this->Database, $DbRow['Id']);
     305      $Realm = new Realm($this->System, $DbRow['Id']);
    311306      $UsedMemory += $Realm->GetUsedMemory();
    312307    }
     
    335330  function UpdateRealmlistAccountCount()
    336331  {
    337     global $Config;
    338    
    339332    $this->Database->query('TRUNCATE TABLE server'.$this->Id.'_realmd.realmcharacters');
    340333    $DbResult = $this->Database->select('Realm', '*', 'Server = '.$this->Id);
     
    345338  }
    346339}
    347 
    348 ?>
Note: See TracChangeset for help on using the changeset viewer.