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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
30ec0afd
Commit
30ec0afd
authored
Jul 07, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugger WIP
parent
faf445bb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
120 additions
and
29 deletions
+120
-29
assets.php
framework/yii/assets.php
+13
-7
assets.php
framework/yii/bootstrap/assets.php
+5
-0
Module.php
framework/yii/debug/Module.php
+4
-4
main.css
framework/yii/debug/assets/main.css
+46
-0
yii.debug.js
framework/yii/debug/assets/yii.debug.js
+0
-0
DefaultController.php
framework/yii/debug/controllers/DefaultController.php
+11
-2
ConfigPanel.php
framework/yii/debug/panels/ConfigPanel.php
+0
-0
ProfilingPanel.php
framework/yii/debug/panels/ProfilingPanel.php
+5
-5
RequestPanel.php
framework/yii/debug/panels/RequestPanel.php
+2
-2
index.php
framework/yii/debug/views/default/index.php
+4
-1
toolbar.php
framework/yii/debug/views/default/toolbar.php
+29
-7
main.php
framework/yii/debug/views/layouts/main.php
+1
-1
No files found.
framework/yii/assets.php
View file @
30ec0afd
...
...
@@ -35,13 +35,6 @@ return array(
),
'depends'
=>
array
(
'yii'
),
),
'yii/debug'
=>
array
(
'sourcePath'
=>
__DIR__
.
'/assets'
,
'js'
=>
array
(
'yii.debug.js'
,
),
'depends'
=>
array
(
'yii'
),
),
'yii/punycode'
=>
array
(
'sourcePath'
=>
__DIR__
.
'/assets'
,
'js'
=>
array
(
...
...
@@ -55,4 +48,17 @@ return array(
),
'depends'
=>
array
(
'yii/jquery'
),
),
'yii/debug'
=>
array
(
'sourcePath'
=>
__DIR__
.
'/debug/assets'
,
'css'
=>
array
(
'main.css'
,
),
'js'
=>
array
(
'yii.debug.js'
,
),
'depends'
=>
array
(
'yii'
,
'yii/bootstrap/responsive'
,
),
),
);
framework/yii/bootstrap/assets.php
View file @
30ec0afd
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
return
array
(
'yii/bootstrap'
=>
array
(
...
...
framework/yii/debug/Module.php
View file @
30ec0afd
...
...
@@ -39,7 +39,7 @@ class Module extends \yii\base\Module
* @var string the directory storing the debugger data files. This can be specified using a path alias.
*/
public
$dataPath
=
'@runtime/debug'
;
public
$historySize
=
5
;
public
$historySize
=
5
0
;
public
function
init
()
{
...
...
@@ -90,6 +90,9 @@ class Module extends \yii\base\Module
protected
function
corePanels
()
{
return
array
(
'config'
=>
array
(
'class'
=>
'yii\debug\panels\ConfigPanel'
,
),
'request'
=>
array
(
'class'
=>
'yii\debug\panels\RequestPanel'
,
),
...
...
@@ -102,9 +105,6 @@ class Module extends \yii\base\Module
'db'
=>
array
(
'class'
=>
'yii\debug\panels\DbPanel'
,
),
'config'
=>
array
(
'class'
=>
'yii\debug\panels\ConfigPanel'
,
),
);
}
}
framework/yii/debug/assets/main.css
0 → 100644
View file @
30ec0afd
#yii-debug-toolbar
{
position
:
fixed
;
left
:
0
;
right
:
0
;
bottom
:
0
;
margin
:
0
;
padding
:
0
;
z-index
:
1000000
;
font
:
11px
Verdana
,
Arial
,
sans-serif
;
text-align
:
left
;
height
:
38px
;
border-top
:
1px
solid
#ccc
;
background
:
rgb
(
237
,
237
,
237
);
background
:
url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VkZWRlZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUzJSIgc3RvcC1jb2xvcj0iI2Y2ZjZmNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+)
;
background
:
-moz-linear-gradient
(
top
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0%
,
rgba
(
237
,
237
,
237
,
1
)),
color-stop
(
53%
,
rgba
(
246
,
246
,
246
,
1
)),
color-stop
(
100%
,
rgba
(
255
,
255
,
255
,
1
)));
background
:
-webkit-linear-gradient
(
top
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
background
:
-o-linear-gradient
(
top
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
background
:
-ms-linear-gradient
(
top
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
background
:
linear-gradient
(
to
bottom
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#ededed'
,
endColorstr
=
'#ffffff'
,
GradientType
=
0
);
}
.yii-debug-toolbar-block
{
float
:
left
;
margin
:
0
;
border-right
:
1px
solid
#e4e4e4
;
padding
:
4px
8px
;
line-height
:
32px
;
}
.yii-debug-toolbar-block
a
{
text-decoration
:
none
;
color
:
black
!important
;
}
.yii-debug-toolbar-block
span
{
}
.yii-debug-toolbar-block
img
{
vertical-align
:
middle
;
}
span
.indent
{
color
:
#ccc
;
}
framework/yii/assets/yii.debug.js
→
framework/yii/
debug/
assets/yii.debug.js
View file @
30ec0afd
File moved
framework/yii/debug/controllers/DefaultController.php
View file @
30ec0afd
...
...
@@ -21,13 +21,17 @@ class DefaultController extends Controller
public
$module
;
public
$layout
=
'main'
;
public
function
actionIndex
(
$tag
,
$panel
=
null
)
public
function
actionIndex
(
$tag
=
null
,
$panel
=
null
)
{
if
(
$tag
===
null
)
{
$tags
=
array_keys
(
$this
->
getManifest
());
$tag
=
end
(
$tags
);
}
$meta
=
$this
->
loadData
(
$tag
);
if
(
isset
(
$this
->
module
->
panels
[
$panel
]))
{
$activePanel
=
$this
->
module
->
panels
[
$panel
];
}
else
{
$activePanel
=
reset
(
$this
->
module
->
panels
)
;
$activePanel
=
$this
->
module
->
panels
[
'request'
]
;
}
return
$this
->
render
(
'index'
,
array
(
'tag'
=>
$tag
,
...
...
@@ -47,6 +51,11 @@ class DefaultController extends Controller
));
}
public
function
actionPhpinfo
()
{
phpinfo
();
}
private
$_manifest
;
protected
function
getManifest
()
...
...
framework/yii/debug/panels/ConfigPanel.php
View file @
30ec0afd
This diff is collapsed.
Click to expand it.
framework/yii/debug/panels/ProfilingPanel.php
View file @
30ec0afd
...
...
@@ -49,10 +49,10 @@ class ProfilingPanel extends Panel
$rows
=
array
();
foreach
(
$timings
as
$timing
)
{
$time
=
sprintf
(
'%
0.5f'
,
$timing
[
3
]
);
$procedure
=
str_repeat
(
'
'
,
$timing
[
0
]
*
4
)
.
Html
::
encode
(
$timing
[
1
]);
$time
=
sprintf
(
'%
.1f ms'
,
$timing
[
3
]
*
1000
);
$procedure
=
str_repeat
(
'
<span class="indent">→</span>'
,
$timing
[
0
]
)
.
Html
::
encode
(
$timing
[
1
]);
$category
=
Html
::
encode
(
$timing
[
2
]);
$rows
[]
=
"<tr><td
>
$category
</td><td>
$procedure
</td><td>
{
$time
}
s
</td>"
;
$rows
[]
=
"<tr><td
style=
\"
width: 80px;
\"
>
$time
</td><td style=
\"
width: 220px;
\"
>
$category
</td><td>
$procedure
</td>"
;
}
$rows
=
implode
(
"
\n
"
,
$rows
);
...
...
@@ -62,9 +62,9 @@ class ProfilingPanel extends Panel
<table class="table table-condensed table-bordered table-striped table-hover" style="table-layout: fixed;">
<thead>
<tr>
<th>Category</th>
<th style="width: 80px;">Time</th>
<th style="width: 220px;">Category</th>
<th>Procedure</th>
<th>Time</th>
</tr>
</thead>
<tbody>
...
...
framework/yii/debug/panels/RequestPanel.php
View file @
30ec0afd
...
...
@@ -25,8 +25,8 @@ class RequestPanel extends Panel
public
function
getSummary
()
{
$memory
=
sprintf
(
'%.
2f
MB'
,
$this
->
data
[
'memory'
]
/
1048576
);
$time
=
sprintf
(
'%.3fs'
,
$this
->
data
[
'time'
])
;
$memory
=
sprintf
(
'%.
1f
MB'
,
$this
->
data
[
'memory'
]
/
1048576
);
$time
=
number_format
(
$this
->
data
[
'time'
]
*
1000
)
.
' ms'
;
return
<<<EOD
<div class="yii-debug-toolbar-block">
...
...
framework/yii/debug/views/default/index.php
View file @
30ec0afd
...
...
@@ -12,12 +12,15 @@ use yii\helpers\Html;
*/
$this
->
registerAssetBundle
(
'yii/bootstrap/dropdown'
);
$this
->
title
=
'Yii Debugger'
;
?>
<div
class=
"default-index"
>
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<div
class=
"container"
>
<span
class=
"brand"
>
Yii Debugger
</span>
<?php
foreach
(
$panels
as
$panel
)
:
?>
<?php
echo
$panel
->
getSummary
();
?>
<?php
endforeach
;
?>
</div>
</div>
</div>
...
...
framework/yii/debug/views/default/toolbar.php
View file @
30ec0afd
...
...
@@ -12,24 +12,46 @@ use yii\helpers\Html;
left
:
0
;
right
:
0
;
bottom
:
0
;
background-color
:
#eee
;
border-top
:
1px
solid
#ccc
;
margin
:
0
;
padding
:
5px
10px
;
padding
:
0
;
z-index
:
1000000
;
font
:
11px
Verdana
,
Arial
,
sans-serif
;
text-align
:
left
;
height
:
38px
;
border-top
:
1px
solid
#ccc
;
background
:
rgb
(
237
,
237
,
237
);
background
:
url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VkZWRlZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUzJSIgc3RvcC1jb2xvcj0iI2Y2ZjZmNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+)
;
background
:
-moz-linear-gradient
(
top
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0%
,
rgba
(
237
,
237
,
237
,
1
)),
color-stop
(
53%
,
rgba
(
246
,
246
,
246
,
1
)),
color-stop
(
100%
,
rgba
(
255
,
255
,
255
,
1
)));
background
:
-webkit-linear-gradient
(
top
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
background
:
-o-linear-gradient
(
top
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
background
:
-ms-linear-gradient
(
top
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
background
:
linear-gradient
(
to
bottom
,
rgba
(
237
,
237
,
237
,
1
)
0%
,
rgba
(
246
,
246
,
246
,
1
)
53%
,
rgba
(
255
,
255
,
255
,
1
)
100%
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#ededed'
,
endColorstr
=
'#ffffff'
,
GradientType
=
0
);
}
.yii-debug-toolbar-block
{
float
:
left
;
margin
:
0
10px
;
margin
:
0
;
border-right
:
1px
solid
#e4e4e4
;
padding
:
4px
8px
;
line-height
:
32px
;
}
.yii-debug-toolbar-block
a
{
text-decoration
:
none
;
color
:
black
!important
;
}
.yii-debug-toolbar-block
span
{
}
.yii-debug-toolbar-block
img
{
vertical-align
:
middle
;
}
</style>
<div
id=
"yii-debug-toolbar"
>
<div
class=
"yii-debug-toolbar-block"
>
<?php
echo
Html
::
a
(
'Yii Debugger'
,
array
(
'index'
,
'tag'
=>
$tag
));
?>
</div>
<?php
foreach
(
$panels
as
$panel
)
:
?>
<?php
echo
$panel
->
getSummary
();
?>
<?php
endforeach
;
?>
...
...
framework/yii/debug/views/layouts/main.php
View file @
30ec0afd
...
...
@@ -5,7 +5,7 @@
*/
use
yii\helpers\Html
;
Yii
::
$app
->
getView
()
->
registerAssetBundle
(
'yii/
bootstrap/responsive
'
);
Yii
::
$app
->
getView
()
->
registerAssetBundle
(
'yii/
debug
'
);
?>
<!DOCTYPE html>
<html>
...
...
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