Changeset 53


Ignore:
Timestamp:
Jul 4, 2009, 9:50:22 AM (15 years ago)
Author:
george
Message:
  • Přidáno: Funkce pro generování patchlistu.
  • Přidáno: Testovací funkce pro čtení z logovací roury.
Location:
trunk/www
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/server.php

    r52 r53  
    403403  } 
    404404
     405  function GetPatchList()
     406  {
     407    // http://us.version.worldofwarcraft.com/update/PatchSequenceFile.txt
     408    $Output = array('[WoW]', 'CurrentBuild='.$this->Server['Database']['Emulator']['Client']['BuildNumber']);
     409    $DbResult = $this->Database->query('SELECT * FROM Client WHERE BuildNumber <= '.$this->Server['Database']['Emulator']['Client']['BuildNumber'].' AND Patch != "" ORDER BY BuildNumber');
     410    while($DbRow = $DbResult->fetch_assoc())
     411    {
     412      $Output[] = $DbRow['BuildNumber'].'='.$DbRow['Patch'];
     413    }
     414    return(implode("\n", $Output));
     415  }
     416 
     417  function ProcessLog()
     418  {
     419    $File = fopen('../server/'.$this->Id.'/log/mangos-worldd.log', 'r');
     420    while(true)
     421    {
     422      $Reders = array($File);
     423      if(stream_select($Reders, $Writers=null, $Except=null, 0, 15) < 1)
     424      {
     425        continue;
     426      } else
     427      {
     428        // read data from the fifo
     429        $Data = fread($File, 1024);
     430        echo($Data);
     431        $this->Database->insert('ServerLog', array('Time' => 'NOW()', 'Server' => $this->Id, 'Text' => $Data));
     432      }         
     433      sleep(1);
     434    }
     435    fclose($File);
     436  }
    405437}
    406438
  • trunk/www/shell.php

    r51 r53  
    112112        }
    113113      } else
     114      if($Command == 'ServerProcessLogPipe')
     115      {
     116        if((count($_SERVER['argv']) > 2) and is_numeric($_SERVER['argv'][2]))
     117        {
     118          $Server = new Server($this->Database, $_SERVER['argv'][2]);
     119          $Server->ProcessLog();
     120        } else $Output = 'Jako druhý parameter je nutno zadat Id serveru.';
     121      } else
    114122      if($Command == 'HistoryUpdate')
    115123      {
  • trunk/www/user.php

    r52 r53  
    4545    $SID = session_id();
    4646
    47     // Remove nonactive users
     47    // Remove inactive users
    4848    $DbResult = $this->Database->select('UserOnline', 'Id, User', 'ActivityTime < DATE_SUB(NOW(), INTERVAL '.$this->OnlineStateTimeout.' SECOND)');
    4949    while($DbRow = $DbResult->fetch_array())
    5050    {
     51      $this->System->Modules['User']->User['Id'] = $DbRow['User'];
    5152      if($DbRow['User'] != $this->AnonymousUserId) $this->System->Modules['Log']->NewRecord('User', 'Logout');
    5253      $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']);
Note: See TracChangeset for help on using the changeset viewer.