Since: 2.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends yii\debug\Panel
Exemplo n.º 1
0
 public function run($seq, $tag)
 {
     $this->controller->loadData($tag);
     $timings = $this->panel->calculateTimings();
     if (!isset($timings[$seq])) {
         throw new HttpException(404, 'Log message not found.');
     }
     $query = $timings[$seq]['info'];
     $result = $this->panel->getDb()->createCommand('EXPLAIN ' . $query)->queryOne();
     if (isset($result['id'])) {
         unset($result['id']);
     }
     $output = [];
     foreach ($result as $key => $value) {
         if ($value) {
             $output[] = sprintf('<b>%s</b>: %s', $key, $value);
         }
     }
     return implode('<br/>', $output);
 }
Exemplo n.º 2
0
 public function run($seq, $tag)
 {
     $this->controller->loadData($tag);
     $timings = $this->panel->calculateTimings();
     if (!isset($timings[$seq])) {
         throw new HttpException(404, 'Log message not found.');
     }
     $query = $timings[$seq]['info'];
     $results = $this->panel->getDb()->createCommand('EXPLAIN ' . $query)->queryAll();
     $output[] = '<table class="table"><thead><tr>' . implode(array_map(function ($key) {
         return '<th>' . $key . '</th>';
     }, array_keys($results[0]))) . '</tr></thead><tbody>';
     foreach ($results as $result) {
         $output[] = '<tr>' . implode(array_map(function ($value) {
             return '<td>' . (empty($value) ? 'NULL' : htmlspecialchars($value)) . '</td>';
         }, $result)) . '</tr>';
     }
     $output[] = '</tbody></table>';
     return implode($output);
 }
Exemplo n.º 3
0
 public function save()
 {
     $data = parent::save();
     return isset($data['messages']) && count($data['messages']) > 0 ? $data : null;
 }