Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
4d616298
Commit
4d616298
authored
Feb 11, 2014
by
Tobias Munk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added check for db and request panel, disabled output if one is missing
parent
87cb3e5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
67 deletions
+74
-67
index.php
extensions/debug/views/default/index.php
+74
-67
No files found.
extensions/debug/views/default/index.php
View file @
4d616298
...
@@ -31,81 +31,88 @@ $this->title = 'Yii Debugger';
...
@@ -31,81 +31,88 @@ $this->title = 'Yii Debugger';
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"row"
>
<h1>
Available Debug Data
</h1>
<?php
<?php
$timeFormatter
=
extension_loaded
(
'intl'
)
?
Yii
::
createObject
([
'class'
=>
'yii\i18n\Formatter'
])
:
Yii
::
$app
->
formatter
;
if
(
isset
(
$this
->
context
->
module
->
panels
[
'db'
])
&&
isset
(
$this
->
context
->
module
->
panels
[
'request'
]))
{
echo
GridView
::
widget
([
echo
" <h1>Available Debug Data</h1>"
;
'dataProvider'
=>
$dataProvider
,
$timeFormatter
=
extension_loaded
(
'intl'
)
?
Yii
::
createObject
([
'class'
=>
'yii\i18n\Formatter'
])
:
Yii
::
$app
->
formatter
;
'filterModel'
=>
$searchModel
,
'rowOptions'
=>
function
(
$model
,
$key
,
$index
,
$grid
)
use
(
$searchModel
)
{
$dbPanel
=
$this
->
context
->
module
->
panels
[
'db'
];
if
(
$searchModel
->
isCodeCritical
(
$model
[
'statusCode'
])
||
$dbPanel
->
isQueryCountCritical
(
$model
[
'sqlCount'
]))
{
echo
GridView
::
widget
([
return
[
'class'
=>
'danger'
];
'dataProvider'
=>
$dataProvider
,
}
else
{
'filterModel'
=>
$searchModel
,
return
[];
'rowOptions'
=>
function
(
$model
,
$key
,
$index
,
$grid
)
use
(
$searchModel
)
{
}
$dbPanel
=
$this
->
context
->
module
->
panels
[
'db'
];
},
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
[
'attribute'
=>
'tag'
,
'value'
=>
function
(
$data
)
{
return
Html
::
a
(
$data
[
'tag'
],
[
'view'
,
'tag'
=>
$data
[
'tag'
]]);
},
'format'
=>
'html'
,
],
[
'attribute'
=>
'time'
,
'value'
=>
function
(
$data
)
use
(
$timeFormatter
)
{
return
$timeFormatter
->
asDateTime
(
$data
[
'time'
],
'short'
);
},
],
'ip'
,
[
'attribute'
=>
'sqlCount'
,
'label'
=>
'Total queries'
,
'value'
=>
function
(
$data
)
{
$dbPanel
=
$this
->
context
->
module
->
panels
[
'db'
];
if
(
$dbPanel
->
isQueryCountCritical
(
$data
[
'sqlCount'
]))
{
if
(
$searchModel
->
isCodeCritical
(
$model
[
'statusCode'
])
||
$dbPanel
->
isQueryCountCritical
(
$model
[
'sqlCount'
]))
{
return
[
'class'
=>
'danger'
];
}
else
{
return
[];
}
},
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
[
'attribute'
=>
'tag'
,
'value'
=>
function
(
$data
)
{
return
Html
::
a
(
$data
[
'tag'
],
[
'view'
,
'tag'
=>
$data
[
'tag'
]]);
},
'format'
=>
'html'
,
],
[
'attribute'
=>
'time'
,
'value'
=>
function
(
$data
)
use
(
$timeFormatter
)
{
return
$timeFormatter
->
asDateTime
(
$data
[
'time'
],
'short'
);
},
],
'ip'
,
[
'attribute'
=>
'sqlCount'
,
'label'
=>
'Total queries'
,
'value'
=>
function
(
$data
)
{
$dbPanel
=
$this
->
context
->
module
->
panels
[
'db'
];
$content
=
Html
::
tag
(
'b'
,
$data
[
'sqlCount'
])
.
' '
.
Html
::
tag
(
'span'
,
''
,
[
'class'
=>
'glyphicon glyphicon-exclamation-sign'
]);
if
(
$dbPanel
->
isQueryCountCritical
(
$data
[
'sqlCount'
]))
{
return
Html
::
a
(
$content
,
[
'view'
,
'panel'
=>
'db'
,
'tag'
=>
$data
[
'tag'
]],
[
'title'
=>
'Too many queries. Allowed count is '
.
$dbPanel
->
criticalQueryThreshold
,
]);
}
else
{
$content
=
Html
::
tag
(
'b'
,
$data
[
'sqlCount'
])
.
' '
.
Html
::
tag
(
'span'
,
''
,
[
'class'
=>
'glyphicon glyphicon-exclamation-sign'
]);
return
$data
[
'sqlCount'
];
return
Html
::
a
(
$content
,
[
'view'
,
'panel'
=>
'db'
,
'tag'
=>
$data
[
'tag'
]],
[
}
'title'
=>
'Too many queries. Allowed count is '
.
$dbPanel
->
criticalQueryThreshold
,
},
]);
'format'
=>
'html'
,
],
}
else
{
[
return
$data
[
'sqlCount'
];
'attribute'
=>
'method'
,
}
'filter'
=>
[
'get'
=>
'GET'
,
'post'
=>
'POST'
,
'delete'
=>
'DELETE'
,
'put'
=>
'PUT'
,
'head'
=>
'HEAD'
]
},
],
'format'
=>
'html'
,
[
],
'attribute'
=>
'ajax'
,
[
'value'
=>
function
(
$data
)
{
'attribute'
=>
'method'
,
return
$data
[
'ajax'
]
?
'Yes'
:
'No'
;
'filter'
=>
[
'get'
=>
'GET'
,
'post'
=>
'POST'
,
'delete'
=>
'DELETE'
,
'put'
=>
'PUT'
,
'head'
=>
'HEAD'
]
},
],
'filter'
=>
[
'No'
,
'Yes'
],
[
],
'attribute'
=>
'ajax'
,
[
'value'
=>
function
(
$data
)
{
'attribute'
=>
'url'
,
return
$data
[
'ajax'
]
?
'Yes'
:
'No'
;
'label'
=>
'URL'
,
},
],
'filter'
=>
[
'No'
,
'Yes'
],
[
],
'attribute'
=>
'statusCode'
,
[
'filter'
=>
[
200
=>
200
,
404
=>
404
,
403
=>
403
,
500
=>
500
],
'attribute'
=>
'url'
,
'label'
=>
'Status code'
'label'
=>
'URL'
,
],
[
'attribute'
=>
'statusCode'
,
'filter'
=>
[
200
=>
200
,
404
=>
404
,
403
=>
403
,
500
=>
500
],
'label'
=>
'Status code'
],
],
],
],
]);
]);
?>
}
else
{
echo
"<div class='alert alert-warning'>No data available. Panel <code>db</code> or <code>request</code> not found.</div>"
;
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment