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
1f63bf00
Commit
1f63bf00
authored
Aug 10, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor enhancement of debugger.
parent
bc21de98
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
14 deletions
+36
-14
Module.php
framework/yii/debug/Module.php
+21
-6
main.css
framework/yii/debug/assets/main.css
+8
-0
DbPanel.php
framework/yii/debug/panels/DbPanel.php
+2
-3
LogPanel.php
framework/yii/debug/panels/LogPanel.php
+1
-1
ProfilingPanel.php
framework/yii/debug/panels/ProfilingPanel.php
+2
-2
RequestPanel.php
framework/yii/debug/panels/RequestPanel.php
+2
-2
No files found.
framework/yii/debug/Module.php
View file @
1f63bf00
...
@@ -9,6 +9,7 @@ namespace yii\debug;
...
@@ -9,6 +9,7 @@ namespace yii\debug;
use
Yii
;
use
Yii
;
use
yii\base\View
;
use
yii\base\View
;
use
yii\web\HttpException
;
/**
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
...
@@ -64,17 +65,20 @@ class Module extends \yii\base\Module
...
@@ -64,17 +65,20 @@ class Module extends \yii\base\Module
unset
(
Yii
::
$app
->
getLog
()
->
targets
[
'debug'
]);
unset
(
Yii
::
$app
->
getLog
()
->
targets
[
'debug'
]);
$this
->
logTarget
=
null
;
$this
->
logTarget
=
null
;
$ip
=
Yii
::
$app
->
getRequest
()
->
getUserIP
();
if
(
$this
->
checkAccess
(
$action
))
{
foreach
(
$this
->
allowedIPs
as
$filter
)
{
return
true
;
if
(
$filter
===
'*'
||
$filter
===
$ip
||
((
$pos
=
strpos
(
$filter
,
'*'
))
!==
false
&&
!
strncmp
(
$ip
,
$filter
,
$pos
)))
{
}
elseif
(
$action
->
id
===
'toolbar'
)
{
return
parent
::
beforeAction
(
$action
);
}
}
return
false
;
return
false
;
}
else
{
throw
new
HttpException
(
403
,
'You are not allowed to access this page.'
);
}
}
}
public
function
renderToolbar
(
$event
)
public
function
renderToolbar
(
$event
)
{
{
if
(
!
$this
->
checkAccess
())
{
return
;
}
$url
=
Yii
::
$app
->
getUrlManager
()
->
createUrl
(
$this
->
id
.
'/default/toolbar'
,
array
(
$url
=
Yii
::
$app
->
getUrlManager
()
->
createUrl
(
$this
->
id
.
'/default/toolbar'
,
array
(
'tag'
=>
$this
->
logTarget
->
tag
,
'tag'
=>
$this
->
logTarget
->
tag
,
));
));
...
@@ -85,6 +89,17 @@ class Module extends \yii\base\Module
...
@@ -85,6 +89,17 @@ class Module extends \yii\base\Module
echo
'<script>'
.
$view
->
renderPhpFile
(
__DIR__
.
'/views/default/toolbar.js'
)
.
'</script>'
;
echo
'<script>'
.
$view
->
renderPhpFile
(
__DIR__
.
'/views/default/toolbar.js'
)
.
'</script>'
;
}
}
protected
function
checkAccess
()
{
$ip
=
Yii
::
$app
->
getRequest
()
->
getUserIP
();
foreach
(
$this
->
allowedIPs
as
$filter
)
{
if
(
$filter
===
'*'
||
$filter
===
$ip
||
((
$pos
=
strpos
(
$filter
,
'*'
))
!==
false
&&
!
strncmp
(
$ip
,
$filter
,
$pos
)))
{
return
true
;
}
}
return
false
;
}
protected
function
corePanels
()
protected
function
corePanels
()
{
{
return
array
(
return
array
(
...
...
framework/yii/debug/assets/main.css
View file @
1f63bf00
body
{
padding-top
:
60px
;
}
#yii-debug-toolbar
{
#yii-debug-toolbar
{
position
:
fixed
;
top
:
0
;
left
:
0
;
right
:
0
;
margin
:
0
0
20px
0
;
margin
:
0
0
20px
0
;
padding
:
0
;
padding
:
0
;
z-index
:
1000000
;
z-index
:
1000000
;
...
...
framework/yii/debug/panels/DbPanel.php
View file @
1f63bf00
...
@@ -36,9 +36,8 @@ class DbPanel extends Panel
...
@@ -36,9 +36,8 @@ class DbPanel extends Panel
$url
=
$this
->
getUrl
();
$url
=
$this
->
getUrl
();
$output
=
<<<EOD
$output
=
<<<EOD
<div class="yii-debug-toolbar-block">
<div class="yii-debug-toolbar-block">
<a href="$url">
<a href="$url" title="Executed $queryCount database queries which took $queryTime.">
DB queries: <span class="label">$queryCount</span>
DB <span class="label">$queryCount</span> <span class="label">$queryTime</span>
time: <span class="label">$queryTime</span>
</a>
</a>
</div>
</div>
EOD;
EOD;
...
...
framework/yii/debug/panels/LogPanel.php
View file @
1f63bf00
...
@@ -44,7 +44,7 @@ class LogPanel extends Panel
...
@@ -44,7 +44,7 @@ class LogPanel extends Panel
$url
=
$this
->
getUrl
();
$url
=
$this
->
getUrl
();
return
<<<EOD
return
<<<EOD
<div class="yii-debug-toolbar-block">
<div class="yii-debug-toolbar-block">
<a href="$url" title="$title">Log
:
$log</a>
<a href="$url" title="$title">Log $log</a>
</div>
</div>
EOD;
EOD;
}
}
...
...
framework/yii/debug/panels/ProfilingPanel.php
View file @
1f63bf00
...
@@ -33,10 +33,10 @@ class ProfilingPanel extends Panel
...
@@ -33,10 +33,10 @@ class ProfilingPanel extends Panel
return
<<<EOD
return
<<<EOD
<div class="yii-debug-toolbar-block">
<div class="yii-debug-toolbar-block">
<a href="$url" title="Total
processing time">Time:
<span class="label">$time</span></a>
<a href="$url" title="Total
request processing time was $time">Time
<span class="label">$time</span></a>
</div>
</div>
<div class="yii-debug-toolbar-block">
<div class="yii-debug-toolbar-block">
<a href="$url" title="Peak memory consumption">Memory
:
<span class="label">$memory</span></a>
<a href="$url" title="Peak memory consumption">Memory <span class="label">$memory</span></a>
</div>
</div>
EOD;
EOD;
}
}
...
...
framework/yii/debug/panels/RequestPanel.php
View file @
1f63bf00
...
@@ -45,10 +45,10 @@ class RequestPanel extends Panel
...
@@ -45,10 +45,10 @@ class RequestPanel extends Panel
return
<<<EOD
return
<<<EOD
<div class="yii-debug-toolbar-block">
<div class="yii-debug-toolbar-block">
<a href="$url" title="Status code: $statusCode $statusText">Status
:
<span class="label $class">$statusCode</span></a>
<a href="$url" title="Status code: $statusCode $statusText">Status <span class="label $class">$statusCode</span></a>
</div>
</div>
<div class="yii-debug-toolbar-block">
<div class="yii-debug-toolbar-block">
<a href="$url">Action
:
<span class="label">{$this->data['action']}</span></a>
<a href="$url">Action <span class="label">{$this->data['action']}</span></a>
</div>
</div>
EOD;
EOD;
}
}
...
...
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