Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function run($logId, $tag) |
||
34 | { |
||
35 | $this->controller->loadData($tag); |
||
36 | |||
37 | $timings = $this->panel->getTimings(); |
||
38 | ArrayHelper::multisort($timings, 3, SORT_DESC); |
||
39 | |||
40 | if (!isset($timings[$logId])) { |
||
41 | throw new HttpException(404, 'Log message not found.'); |
||
42 | } |
||
43 | |||
44 | $request = unserialize($timings[$logId][1]); |
||
45 | $db = Yii::$app->get($request->getDbname()); |
||
46 | $time = microtime(true); |
||
47 | $response = $db->send($request); |
||
48 | $time = microtime(true) - $time; |
||
49 | |||
50 | Yii::$app->response->format = Response::FORMAT_JSON; |
||
51 | |||
52 | return [ |
||
53 | 'time' => sprintf('%.1f ms', $time * 1000), |
||
54 | 'result' => $response->getData(), |
||
55 | ]; |
||
56 | } |
||
57 | } |
||
58 |