Changeset 63


Ignore:
Timestamp:
Aug 5, 2009, 8:06:27 AM (15 years ago)
Author:
george
Message:
  • Přidáno: Funkce a skript pro aktualizaci stavových údajů. Bude prováděno každou minutu nebo automaticky přímo systémem při určitých operacích.
  • Opraveno: Generování přístupu k databázi v nastavení emulátoru.
Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/model/realm.php

    r62 r63  
    213213    $EmulatorConfig = new MangosConfigurationFile($this->Database);
    214214    $EmulatorConfig->Load($EmulatorEtcDir.'mangosd.conf.dist');
    215     $EmulatorConfig->ParameterList['LoginDatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';server'.$this->Data['Server'].'_realmd';
    216     $EmulatorConfig->ParameterList['WorldDatabaseInfo'] = 'localhost;3306;server'.$this->Id.';server'.$this->Id.';realm'.$this->Id.'_mangos';
     215    $EmulatorConfig->ParameterList['LoginDatabaseInfo'] = 'localhost;3306;server'.$this->Data['Server'].';server'.$this->Data['Server'].';server'.$this->Data['Server'].'_realmd';
     216    $EmulatorConfig->ParameterList['WorldDatabaseInfo'] = 'localhost;3306;server'.$this->Data['Server'].';server'.$this->Data['Server'].';realm'.$this->Id.'_mangos';
    217217    $EmulatorConfig->ParameterList['CharacterDatabaseInfo'] = 'localhost;3306;server'.$this->Data['Server'].';server'.$this->Data['Server'].';realm'.$this->Id.'_characters';
    218218    $EmulatorConfig->ParameterList['ScriptDev2DatabaseInfo'] = 'localhost;3306;server'.$this->Data['Server'].';server'.$this->Data['Server'].';realm'.$this->Id.'_scriptdev2';
     
    307307    $Output = array();
    308308    if(isset($this->Data['Database']['Emulator']['Id']))
    309       exec('ps -aux|grep "emulator/'.$this->Data['Database']['Emulator']['Id'].'/bin/mangos-worldd -c realm/'.$this->Id.'/etc/mangosd.conf"| grep -v grep', $Output);
     309      exec('ps aux|grep "emulator/'.$this->Data['Database']['Emulator']['Id'].'/bin/mangos-worldd -c realm/'.$this->Id.'/etc/mangosd.conf"| grep -v grep', $Output);
    310310    if(count($Output) > 0)
    311311    {
     
    321321    while(true)
    322322    {
    323       $Reders = array($File);
    324       if(stream_select($Reders, $Writers=null, $Except=null, 0, 15) < 1)
     323      $Readers = array($File);
     324      if(stream_select($Readers, $Writers=null, $Except=null, 0, 15) < 1)
    325325      {
    326326        continue;
     
    343343    return($DbRow['User']);
    344344  }
     345 
     346  function UpdateState()
     347  {
     348    $State = $this->GetState();
     349    $this->Database->update('Realm', 'Id='.$this->Id, array(
     350      'Online' => $State['Online'],
     351      'CharacterOnlineCount' => $State['CharacterOnlineCount'],
     352      'CharacterCount' => $State['CharacterCount'], 
     353    ));
     354  }
     355 
     356  function UpdateStateAll()
     357  {
     358    $DbResult = $this->Database->select('Realm', 'Id');
     359    while($DbRow = $DbResult->fetch_assoc())
     360    {
     361      $Realm = new Realm($this->Database, $DbRow['Id']);
     362      $Realm->UpdateState();
     363    }   
     364  }
    345365}
    346366
  • trunk/www/model/server.php

    r62 r63  
    162162  }
    163163 
    164   function UpdateServerList()
     164  function UpdateState()
     165  {
     166    $State = $this->GetState();
     167    $this->Database->update('Server', 'Id='.$this->Id, array(
     168      'Online' => $State['Online'],
     169      'AccountCount' => $State['AccountCount'],
     170    ));
     171  }
     172 
     173  function UpdateStateAll()
    165174  {
    166175    $DbResult = $this->Database->select('Server', 'Id');
     
    168177    {
    169178      $Server = new Server($this->Database, $DbRow['Id']);
    170       $ServerState = $Server->GetState();
    171       $this->Database->update('Server', 'Id='.$DbRow['Id'], array(
    172         'Online' => $ServerState['Online'],
    173         'AccountCount' => $ServerState['AccountCount'],
    174       ));
     179      $Server->UpdateState();
    175180    }   
    176181  }
  • trunk/www/model/shell.php

    r57 r63  
    138138        $this->HistoryUpdate();
    139139      } else
     140      if($Command == 'UpdateState')
     141      {
     142        $Realm = new Realm($this->Database, 0);
     143        $Realm->UpdateStateAll();
     144        $Server = new Server($this->Database, 0);
     145        $Server->UpdateStateAll();
     146      } else
    140147      if($Command == 'ServerDatabaseChange')
    141148      {
  • trunk/www/view/server.php

    r57 r63  
    8484    global $Config;
    8585   
    86     $Server = new Server($this->Database, 0);
    87     $Server->UpdateServerList();
    8886    $Output = '<h4>Seznam serverů</h4>';
    8987    $Table = new Table($this->ItemListFormClass);
Note: See TracChangeset for help on using the changeset viewer.