Luciano Baraglia 11 years ago
parent
commit
a1e511465c
  1. 4
      extensions/yii/debug/controllers/DefaultController.php
  2. 8
      extensions/yii/debug/panels/DbPanel.php
  3. 8
      extensions/yii/debug/panels/LogPanel.php
  4. 4
      extensions/yii/debug/panels/ProfilingPanel.php
  5. 18
      extensions/yii/debug/views/default/panels/request/detail.php
  6. 2
      extensions/yii/debug/views/default/view.php

4
extensions/yii/debug/controllers/DefaultController.php

@ -20,7 +20,7 @@ class DefaultController extends Controller
{ {
public $layout = 'main'; public $layout = 'main';
/** /**
* @var \yii\debug\Module * @var \yii\debug\Module
*/ */
public $module; public $module;
/** /**
@ -88,7 +88,7 @@ class DefaultController extends Controller
protected function getManifest($forceReload = false) protected function getManifest($forceReload = false)
{ {
if ($this->_manifest === null || $forceReload) { if ($this->_manifest === null || $forceReload) {
if ($forceReload) { if ($forceReload) {
clearstatcache(); clearstatcache();
} }
$indexFile = $this->module->dataPath . '/index.data'; $indexFile = $this->module->dataPath . '/index.data';

8
extensions/yii/debug/panels/DbPanel.php

@ -42,7 +42,7 @@ class DbPanel extends Panel
$queryCount = count($timings); $queryCount = count($timings);
$queryTime = number_format($this->getTotalQueryTime($timings) * 1000) . ' ms'; $queryTime = number_format($this->getTotalQueryTime($timings) * 1000) . ' ms';
return Yii::$app->view->render('panels/db/summary',[ return Yii::$app->view->render('panels/db/summary', [
'timings' => $this->calculateTimings(), 'timings' => $this->calculateTimings(),
'panel' => $this, 'panel' => $this,
'queryCount' => $queryCount, 'queryCount' => $queryCount,
@ -55,7 +55,7 @@ class DbPanel extends Panel
$searchModel = new Db(); $searchModel = new Db();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels()); $dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels());
return Yii::$app->view->render('panels/db/detail', [ return Yii::$app->view->render('panels/db/detail', [
'panel' => $this, 'panel' => $this,
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'searchModel' => $searchModel, 'searchModel' => $searchModel,
@ -112,9 +112,9 @@ class DbPanel extends Panel
$this->_models[] = [ $this->_models[] = [
'type' => $this->detectQueryType($dbTiming['info']), 'type' => $this->detectQueryType($dbTiming['info']),
'query' => $dbTiming['info'], 'query' => $dbTiming['info'],
'duration' => ($dbTiming['duration'] * 1000), #in milliseconds 'duration' => ($dbTiming['duration'] * 1000), // in milliseconds
'trace' => $dbTiming['trace'], 'trace' => $dbTiming['trace'],
'timestamp' => $dbTiming['timestamp'], 'timestamp' => ($dbTiming['timestamp'] * 1000), // in milliseconds
'seq' => $seq, 'seq' => $seq,
]; ];
} }

8
extensions/yii/debug/panels/LogPanel.php

@ -33,7 +33,7 @@ class LogPanel extends Panel
public function getSummary() public function getSummary()
{ {
return Yii::$app->view->render('panels/log/summary', ['data' => $this->data, 'panel' => $this]); return Yii::$app->view->render('panels/log/summary', ['data' => $this->data, 'panel' => $this]);
} }
public function getDetail() public function getDetail()
@ -41,7 +41,7 @@ class LogPanel extends Panel
$searchModel = new Log(); $searchModel = new Log();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels()); $dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels());
return Yii::$app->view->render('panels/log/detail',[ return Yii::$app->view->render('panels/log/detail', [
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'panel' => $this, 'panel' => $this,
'searchModel' => $searchModel, 'searchModel' => $searchModel,
@ -61,7 +61,7 @@ class LogPanel extends Panel
* @param boolean $refresh if needed to build models from log messages and refresh them. * @param boolean $refresh if needed to build models from log messages and refresh them.
* @return array models * @return array models
*/ */
protected function getModels($refresh=false) protected function getModels($refresh = false)
{ {
if ($this->_models === null || $refresh) { if ($this->_models === null || $refresh) {
$this->_models = []; $this->_models = [];
@ -71,7 +71,7 @@ class LogPanel extends Panel
'message' => $message[0], 'message' => $message[0],
'level' => $message[1], 'level' => $message[1],
'category' => $message[2], 'category' => $message[2],
'time' => ($message[3] * 1000), #time in milliseconds 'time' => ($message[3] * 1000), // time in milliseconds
'trace' => $message[4] 'trace' => $message[4]
]; ];
} }

4
extensions/yii/debug/panels/ProfilingPanel.php

@ -32,7 +32,7 @@ class ProfilingPanel extends Panel
public function getSummary() public function getSummary()
{ {
return Yii::$app->view->render('panels/profile/summary', [ return Yii::$app->view->render('panels/profile/summary', [
'memory' => sprintf('%.1f MB', $this->data['memory'] / 1048576), 'memory' => sprintf('%.1f MB', $this->data['memory'] / 1048576),
'time' => number_format($this->data['time'] * 1000) . ' ms', 'time' => number_format($this->data['time'] * 1000) . ' ms',
'panel' => $this 'panel' => $this
@ -44,7 +44,7 @@ class ProfilingPanel extends Panel
$searchModel = new Profile(); $searchModel = new Profile();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels()); $dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels());
return Yii::$app->view->render('panels/profile/detail', [ return Yii::$app->view->render('panels/profile/detail', [
'panel' => $this, 'panel' => $this,
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'searchModel' => $searchModel, 'searchModel' => $searchModel,

18
extensions/yii/debug/views/default/panels/request/detail.php

@ -9,22 +9,22 @@ echo Tabs::widget([
'items' => [ 'items' => [
[ [
'label' => 'Parameters', 'label' => 'Parameters',
'content' => $this->render('panels/request/table', ['caption' => 'Routing', 'values' => ['Route' => $panel->data['route'], 'Action' => $panel->data['action'], 'Parameters' => $panel->data['actionParams']]]) 'content' => $this->render('panels/request/table', ['caption' => 'Routing', 'values' => ['Route' => $panel->data['route'], 'Action' => $panel->data['action'], 'Parameters' => $panel->data['actionParams']]])
. $this->render('panels/request/table', ['caption' => '$_GET', 'values' => $panel->data['GET']]) . $this->render('panels/request/table', ['caption' => '$_GET', 'values' => $panel->data['GET']])
. $this->render('panels/request/table', ['caption' => '$_POST', 'values' => $panel->data['POST']]) . $this->render('panels/request/table', ['caption' => '$_POST', 'values' => $panel->data['POST']])
. $this->render('panels/request/table', ['caption' => '$_FILES', 'values' => $panel->data['FILES']]) . $this->render('panels/request/table', ['caption' => '$_FILES', 'values' => $panel->data['FILES']])
. $this->render('panels/request/table', ['caption' => '$_COOKIE', 'values' => $panel->data['COOKIE']]), . $this->render('panels/request/table', ['caption' => '$_COOKIE', 'values' => $panel->data['COOKIE']]),
'active' => true, 'active' => true,
], ],
[ [
'label' => 'Headers', 'label' => 'Headers',
'content' => $this->render('panels/request/table', ['caption' => 'Request Headers', 'values' => $panel->data['requestHeaders']]) 'content' => $this->render('panels/request/table', ['caption' => 'Request Headers', 'values' => $panel->data['requestHeaders']])
. $this->render('panels/request/table', ['caption' => 'Response Headers', 'values' => $panel->data['responseHeaders']]) . $this->render('panels/request/table', ['caption' => 'Response Headers', 'values' => $panel->data['responseHeaders']])
], ],
[ [
'label' => 'Session', 'label' => 'Session',
'content' => $this->render('panels/request/table', ['caption' => '$_SESSION', 'values' => $panel->data['SESSION']]) 'content' => $this->render('panels/request/table', ['caption' => '$_SESSION', 'values' => $panel->data['SESSION']])
. $this->render('panels/request/table', ['caption' => 'Flashes', 'values' => $panel->data['flashes']]) . $this->render('panels/request/table', ['caption' => 'Flashes', 'values' => $panel->data['flashes']])
], ],
[ [
'label' => '$_SERVER', 'label' => '$_SERVER',

2
extensions/yii/debug/views/default/view.php

@ -18,7 +18,7 @@ $this->title = 'Yii Debugger';
<div class="default-view"> <div class="default-view">
<div id="yii-debug-toolbar"> <div id="yii-debug-toolbar">
<div class="yii-debug-toolbar-block title"> <div class="yii-debug-toolbar-block title">
<?php echo Html::a('Yii Debugger', ['index'],['title' => 'Back to main debug page']);?> <?= Html::a('Yii Debugger', ['index'], ['title' => 'Back to main debug page']) ?>
</div> </div>
<?php foreach ($panels as $panel): ?> <?php foreach ($panels as $panel): ?>
<?= $panel->getSummary() ?> <?= $panel->getSummary() ?>

Loading…
Cancel
Save