Changeset 52
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/server.php
r48 r52 100 100 $this->Task->Add('Start emulátoru', array( 101 101 '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', 104 103 'php www/shell.php ServerUnLock '.$this->Id, 105 104 )); … … 203 202 // Start script 204 203 $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'; 205 220 $Content = array 206 221 ( -
trunk/www/task.php
r41 r52 24 24 chdir($Config['BaseDir']); 25 25 $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 finished27 $this->Database->query('UPDATE Task SET TimeEnd=NOW() WHERE State=2 AND TimeEnd = NULL'); // Set end time to finished tasks28 26 while($Task = $DbResult->fetch_assoc()) 29 27 { … … 45 43 function ProcessAllCycle() 46 44 { 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 47 47 while(1) 48 48 { -
trunk/www/user.php
r49 r52 45 45 $SID = session_id(); 46 46 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 47 55 // Lookup user record 48 56 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); … … 65 73 $Result = USER_NOT_LOGGED; 66 74 } 67 68 // Remove nonactive users69 $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 record77 $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']));80 75 81 76 // Refresh time of last access
Note:
See TracChangeset
for help on using the changeset viewer.