|
@@ -14,7 +14,12 @@ require_once __DIR__ . '/xhprof.io/xhprof/classes/data.php'; |
|
@@ -14,7 +14,12 @@ require_once __DIR__ . '/xhprof.io/xhprof/classes/data.php'; |
14
|
while (true){
|
14
|
while (true){
|
15
|
echo "Start a new checking\n";
|
15
|
echo "Start a new checking\n";
|
16
|
if ($logfiles = glob($Config->performance_dir.'/xhprof*')){
|
16
|
if ($logfiles = glob($Config->performance_dir.'/xhprof*')){
|
17
|
- if (empty($pdo)){
|
17
|
+ try{
|
|
|
18
|
+ if (empty($pdo)){
|
|
|
19
|
+ throw new \Exception;
|
|
|
20
|
+ }
|
|
|
21
|
+ $pdo->query('show processlist');
|
|
|
22
|
+ }catch(\Exception $e){
|
18
|
$pdo = new PDO("mysql:dbname=xhprof.io;host={$Config->mysql_host};port={$Config->mysql_port};charset=utf8", $Config->mysql_user, $Config->mysql_pass);
|
23
|
$pdo = new PDO("mysql:dbname=xhprof.io;host={$Config->mysql_host};port={$Config->mysql_port};charset=utf8", $Config->mysql_user, $Config->mysql_pass);
|
19
|
$xhprof_data_obj = new \ay\xhprof\Data($pdo);
|
24
|
$xhprof_data_obj = new \ay\xhprof\Data($pdo);
|
20
|
}
|
25
|
}
|
|
@@ -35,8 +40,11 @@ while (true){ |
|
@@ -35,8 +40,11 @@ while (true){ |
35
|
if (!is_array($xhprof_data = json_decode($log['data']['context'],true))){
|
40
|
if (!is_array($xhprof_data = json_decode($log['data']['context'],true))){
|
36
|
continue;
|
41
|
continue;
|
37
|
}
|
42
|
}
|
38
|
- if (isset($log['data']['_SERVER'])){
|
|
|
39
|
- list($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']) = array($log['data']['_SERVER']['HTTP_HOST'], $log['data']['_SERVER']['REQUEST_URI'], $log['data']['_SERVER']['REQUEST_METHOD']);
|
43
|
+ if (isset($log['data']['_SERVER']) && is_array($__SERVER = json_decode($log['data']['_SERVER'],true))){
|
|
|
44
|
+ $_SERVER['HTTP_HOST'] = $__SERVER['HTTP_HOST'];
|
|
|
45
|
+ $_SERVER['REQUEST_URI'] = $__SERVER['REQUEST_URI'];
|
|
|
46
|
+ $_SERVER['REQUEST_METHOD'] = $__SERVER['REQUEST_METHOD'];
|
|
|
47
|
+ @$_SERVER['HTTPS'] = $__SERVER['HTTPS'];
|
40
|
}else{
|
48
|
}else{
|
41
|
$_SERVER['HTTP_HOST'] = $_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_METHOD'] = '';
|
49
|
$_SERVER['HTTP_HOST'] = $_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_METHOD'] = '';
|
42
|
}
|
50
|
}
|