Changeset 52


Ignore:
Timestamp:
Jun 20, 2009, 6:22:13 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Spuštěcí skript serverů start.sh spustí procesy emulátoru pouze pokud ještě nejsou spouštěné.
Location:
trunk/www
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/server.php

    r48 r52  
    100100    $this->Task->Add('Start emulátoru', array(
    101101      'php www/shell.php ServerLock '.$this->Id,
    102       'screen -A -m -d -S server'.$this->Id.'-realmd emulator/'.$this->Server['Database']['Emulator']['Id'].'/bin/mangos-realmd -c server/'.$this->Id.'/etc/realmd.conf',
    103       'screen -A -m -d -S server'.$this->Id.'-worldd server/'.$this->Id.'/bin/start.sh',
     102      'server/'.$this->Id.'/bin/start.sh',
    104103      'php www/shell.php ServerUnLock '.$this->Id,
    105104    ));
     
    203202    // Start script
    204203    $ScriptFileName = '../server/'.$this->Id.'/bin/start.sh';
     204    $Content = array
     205    (
     206      '#!/bin/sh',
     207      'if [ -z `ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-realmd\' | grep -v grep | awk \'{print $2}\'` ]',
     208      'then',
     209      'screen -A -m -d -S server'.$this->Id.'-realmd emulator/'.$this->Server['Database']['Emulator']['Id'].'/bin/mangos-realmd -c server/'.$this->Id.'/etc/realmd.conf',
     210      'fi',
     211      'if [ -z `ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-worldd\' | grep -v grep | awk \'{print $2}\'` ]',
     212      'then',
     213      'screen -A -m -d -S server'.$this->Id.'-worldd server/'.$this->Id.'/bin/worldd_restarter.sh',
     214      'fi',
     215    );
     216    file_put_contents($ScriptFileName, implode("\n", $Content));
     217    chmod($ScriptFileName, 0777);   
     218
     219    $ScriptFileName = '../server/'.$this->Id.'/bin/worldd_restarter.sh';
    205220    $Content = array
    206221    (
  • trunk/www/task.php

    r41 r52  
    2424    chdir($Config['BaseDir']);
    2525    $DbResult = $this->Database->query('SELECT * FROM Task WHERE State = 0 ORDER BY Id,TimeCreate ASC');
    26     $this->Database->query('UPDATE Task SET State=2 WHERE State=1'); // Change not finished running tasks to finished
    27     $this->Database->query('UPDATE Task SET TimeEnd=NOW() WHERE State=2 AND TimeEnd = NULL'); // Set end time to finished tasks
    2826    while($Task = $DbResult->fetch_assoc())
    2927    {
     
    4543  function ProcessAllCycle()
    4644  {
     45    $this->Database->query('UPDATE Task SET State=2 WHERE State=1'); // Change not finished running tasks to finished
     46    $this->Database->query('UPDATE Task SET TimeEnd=NOW() WHERE State=2 AND TimeEnd = NULL'); // Set end time to finished tasks
    4747    while(1)
    4848    {
  • trunk/www/user.php

    r49 r52  
    4545    $SID = session_id();
    4646
     47    // Remove nonactive users
     48    $DbResult = $this->Database->select('UserOnline', 'Id, User', 'ActivityTime < DATE_SUB(NOW(), INTERVAL '.$this->OnlineStateTimeout.' SECOND)');
     49    while($DbRow = $DbResult->fetch_array())
     50    {
     51      if($DbRow['User'] != $this->AnonymousUserId) $this->System->Modules['Log']->NewRecord('User', 'Logout');
     52      $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']);
     53    }
     54
    4755    // Lookup user record
    4856    $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"');
     
    6573      $Result = USER_NOT_LOGGED;
    6674    }
    67 
    68     // Remove nonactive users
    69     $DbResult = $this->Database->select('UserOnline', 'Id, User', 'ActivityTime < DATE_SUB(NOW(), INTERVAL '.$this->OnlineStateTimeout.' SECOND)');
    70     while($DbRow = $DbResult->fetch_array())
    71     {
    72       if($DbRow['User'] != $this->AnonymousUserId) $this->System->Modules['Log']->NewRecord('User', 'Logout');
    73       $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']);
    74     }
    75 
    76     // Lookup user record
    77     $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"');
    78     if($Query->num_rows == 0)
    79       $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF']));
    8075
    8176    // Refresh time of last access
Note: See TracChangeset for help on using the changeset viewer.