|
1
|
|
|
<?php |
|
2
|
|
|
namespace PHPDaemon\Applications; |
|
3
|
|
|
|
|
4
|
|
|
use PHPDaemon\Core\Daemon; |
|
5
|
|
|
use PHPDaemon\HTTPRequest\Generic; |
|
6
|
|
|
use PHPDaemon\Utils\DateTime; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @package Applications |
|
10
|
|
|
* @subpackage ServerStatus |
|
11
|
|
|
* |
|
12
|
|
|
* @author Vasily Zorin <[email protected]> |
|
13
|
|
|
*/ |
|
14
|
|
|
class ServerStatusRequest extends Generic |
|
15
|
|
|
{ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Called when request iterated. |
|
19
|
|
|
* @return integer Status. |
|
|
|
|
|
|
20
|
|
|
*/ |
|
21
|
|
|
public function run() |
|
22
|
|
|
{ |
|
23
|
|
|
$stime = microtime(true); |
|
24
|
|
|
$this->header('Content-Type: text/html; charset=utf-8'); |
|
25
|
|
|
?> |
|
26
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
27
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
28
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
29
|
|
|
<head> |
|
30
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|
31
|
|
|
<title>Server status.</title> |
|
32
|
|
|
</head> |
|
33
|
|
|
<body> |
|
34
|
|
|
<br/>Uptime: <b><?php echo DateTime::diffAsText(Daemon::$startTime, time()); |
|
35
|
|
|
?></b> |
|
36
|
|
|
<br/><br/><b>State of workers:</b><?php $stat = Daemon::getStateOfWorkers(); |
|
37
|
|
|
?> |
|
38
|
|
|
<br/>Idle: <?php echo $stat['idle']; |
|
39
|
|
|
?> |
|
40
|
|
|
<br/>Busy: <?php echo $stat['busy']; |
|
41
|
|
|
?> |
|
42
|
|
|
<br/>Total alive: <?php echo $stat['alive']; |
|
43
|
|
|
?> |
|
44
|
|
|
<br/>Shutdown: <?php echo $stat['shutdown']; |
|
45
|
|
|
?> |
|
46
|
|
|
<br/>Pre-init: <?php echo $stat['preinit']; |
|
47
|
|
|
?> |
|
48
|
|
|
<br/>Wait-init: <?php echo $stat['waitinit']; |
|
49
|
|
|
?> |
|
50
|
|
|
<br/>Init: <?php echo $stat['init']; |
|
51
|
|
|
?> |
|
52
|
|
|
<br/> |
|
53
|
|
|
<br/>Request took: <?php printf('%f', round(microtime(true) - $stime, 6)); |
|
54
|
|
|
?> |
|
55
|
|
|
</body> |
|
56
|
|
|
</html> |
|
57
|
|
|
<?php |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.