Changeset 53 for trunk/www/server.php


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.
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.