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
68281d55
Commit
68281d55
authored
Feb 07, 2014
by
Tobias Munk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed code-style
parent
dc110a9c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
28 additions
and
31 deletions
+28
-31
DebugAsset.php
extensions/debug/DebugAsset.php
+1
-0
LogTarget.php
extensions/debug/LogTarget.php
+0
-1
Module.php
extensions/debug/Module.php
+1
-1
DefaultController.php
extensions/debug/controllers/DefaultController.php
+1
-1
ConfigPanel.php
extensions/debug/panels/ConfigPanel.php
+15
-14
DbPanel.php
extensions/debug/panels/DbPanel.php
+2
-3
LogPanel.php
extensions/debug/panels/LogPanel.php
+2
-2
ProfilingPanel.php
extensions/debug/panels/ProfilingPanel.php
+1
-1
index.php
extensions/debug/views/default/index.php
+5
-8
No files found.
extensions/debug/DebugAsset.php
View file @
68281d55
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\debug
;
namespace
yii\debug
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/debug/LogTarget.php
View file @
68281d55
...
@@ -154,5 +154,4 @@ class LogTarget extends Target
...
@@ -154,5 +154,4 @@ class LogTarget extends Target
# / 2 because messages are in couple (begin/end)
# / 2 because messages are in couple (begin/end)
return
count
(
$profileLogs
[
'messages'
])
/
2
;
return
count
(
$profileLogs
[
'messages'
])
/
2
;
}
}
}
}
extensions/debug/Module.php
View file @
68281d55
...
@@ -72,7 +72,7 @@ class Module extends \yii\base\Module
...
@@ -72,7 +72,7 @@ class Module extends \yii\base\Module
$this
->
dataPath
=
Yii
::
getAlias
(
$this
->
dataPath
);
$this
->
dataPath
=
Yii
::
getAlias
(
$this
->
dataPath
);
$this
->
logTarget
=
Yii
::
$app
->
getLog
()
->
targets
[
'debug'
]
=
new
LogTarget
(
$this
);
$this
->
logTarget
=
Yii
::
$app
->
getLog
()
->
targets
[
'debug'
]
=
new
LogTarget
(
$this
);
// do not initialize view component before application is ready (needed when debug in preload)
// do not initialize view component before application is ready (needed when debug in preload)
Yii
::
$app
->
on
(
Application
::
EVENT_BEFORE_REQUEST
,
function
()
{
Yii
::
$app
->
on
(
Application
::
EVENT_BEFORE_REQUEST
,
function
()
{
Yii
::
$app
->
getView
()
->
on
(
View
::
EVENT_END_BODY
,
[
$this
,
'renderToolbar'
]);
Yii
::
$app
->
getView
()
->
on
(
View
::
EVENT_END_BODY
,
[
$this
,
'renderToolbar'
]);
});
});
...
...
extensions/debug/controllers/DefaultController.php
View file @
68281d55
...
@@ -39,7 +39,7 @@ class DefaultController extends Controller
...
@@ -39,7 +39,7 @@ class DefaultController extends Controller
public
function
actions
()
public
function
actions
()
{
{
$actions
=
[];
$actions
=
[];
foreach
(
$this
->
module
->
panels
as
$panel
)
{
foreach
(
$this
->
module
->
panels
as
$panel
)
{
$actions
=
array_merge
(
$actions
,
$panel
->
actions
);
$actions
=
array_merge
(
$actions
,
$panel
->
actions
);
}
}
return
$actions
;
return
$actions
;
...
...
extensions/debug/panels/ConfigPanel.php
View file @
68281d55
...
@@ -56,21 +56,22 @@ class ConfigPanel extends Panel
...
@@ -56,21 +56,22 @@ class ConfigPanel extends Panel
return
$data
;
return
$data
;
}
}
/**
/**
* Returns the BODY contents of the phpinfo() output
* Returns the BODY contents of the phpinfo() output
*
*
* @return array
* @return array
*/
*/
public
function
getPhpInfo
(){
public
function
getPhpInfo
()
ob_start
();
{
phpinfo
();
ob_start
();
$pinfo
=
ob_get_contents
();
phpinfo
();
ob_end_clean
();
$pinfo
=
ob_get_contents
();
$phpinfo
=
preg_replace
(
'%^.*<body>(.*)</body>.*$%ms'
,
'$1'
,
$pinfo
);
ob_end_clean
();
$phpinfo
=
str_replace
(
'<table '
,
'<table class="table table-condensed table-bordered table-striped table-hover"'
,
$phpinfo
);
$phpinfo
=
preg_replace
(
'%^.*<body>(.*)</body>.*$%ms'
,
'$1'
,
$pinfo
);
$phpinfo
=
str_replace
(
'<table '
,
'<table class="table table-condensed table-bordered table-striped table-hover"'
,
$phpinfo
);
return
$phpinfo
;
return
$phpinfo
;
}
}
/**
/**
* @inheritdoc
* @inheritdoc
...
...
extensions/debug/panels/DbPanel.php
View file @
68281d55
...
@@ -54,7 +54,7 @@ class DbPanel extends Panel
...
@@ -54,7 +54,7 @@ class DbPanel extends Panel
$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
,
'queryTime'
=>
$queryTime
,
'queryTime'
=>
$queryTime
,
...
@@ -127,7 +127,7 @@ class DbPanel extends Panel
...
@@ -127,7 +127,7 @@ class DbPanel extends Panel
$this
->
_models
=
[];
$this
->
_models
=
[];
$timings
=
$this
->
calculateTimings
();
$timings
=
$this
->
calculateTimings
();
foreach
(
$timings
as
$seq
=>
$dbTiming
)
{
foreach
(
$timings
as
$seq
=>
$dbTiming
)
{
$this
->
_models
[]
=
[
$this
->
_models
[]
=
[
'type'
=>
$this
->
getQueryType
(
$dbTiming
[
'info'
]),
'type'
=>
$this
->
getQueryType
(
$dbTiming
[
'info'
]),
'query'
=>
$dbTiming
[
'info'
],
'query'
=>
$dbTiming
[
'info'
],
...
@@ -164,5 +164,4 @@ class DbPanel extends Panel
...
@@ -164,5 +164,4 @@ class DbPanel extends Panel
{
{
return
((
$this
->
criticalQueryThreshold
!==
null
)
&&
(
$count
>
$this
->
criticalQueryThreshold
));
return
((
$this
->
criticalQueryThreshold
!==
null
)
&&
(
$count
>
$this
->
criticalQueryThreshold
));
}
}
}
}
extensions/debug/panels/LogPanel.php
View file @
68281d55
...
@@ -50,7 +50,7 @@ class LogPanel extends Panel
...
@@ -50,7 +50,7 @@ class LogPanel extends Panel
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
getQueryParams
(),
$this
->
getModels
());
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
getQueryParams
(),
$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
,
]);
]);
...
@@ -78,7 +78,7 @@ class LogPanel extends Panel
...
@@ -78,7 +78,7 @@ class LogPanel extends Panel
if
(
$this
->
_models
===
null
||
$refresh
)
{
if
(
$this
->
_models
===
null
||
$refresh
)
{
$this
->
_models
=
[];
$this
->
_models
=
[];
foreach
(
$this
->
data
[
'messages'
]
as
$message
)
{
foreach
(
$this
->
data
[
'messages'
]
as
$message
)
{
$this
->
_models
[]
=
[
$this
->
_models
[]
=
[
'message'
=>
$message
[
0
],
'message'
=>
$message
[
0
],
'level'
=>
$message
[
1
],
'level'
=>
$message
[
1
],
...
...
extensions/debug/panels/ProfilingPanel.php
View file @
68281d55
...
@@ -86,7 +86,7 @@ class ProfilingPanel extends Panel
...
@@ -86,7 +86,7 @@ class ProfilingPanel extends Panel
$this
->
_models
=
[];
$this
->
_models
=
[];
$timings
=
Yii
::
$app
->
getLog
()
->
calculateTimings
(
$this
->
data
[
'messages'
]);
$timings
=
Yii
::
$app
->
getLog
()
->
calculateTimings
(
$this
->
data
[
'messages'
]);
foreach
(
$timings
as
$seq
=>
$profileTiming
)
{
foreach
(
$timings
as
$seq
=>
$profileTiming
)
{
$this
->
_models
[]
=
[
$this
->
_models
[]
=
[
'duration'
=>
$profileTiming
[
'duration'
]
*
1000
,
// in milliseconds
'duration'
=>
$profileTiming
[
'duration'
]
*
1000
,
// in milliseconds
'category'
=>
$profileTiming
[
'category'
],
'category'
=>
$profileTiming
[
'category'
],
...
...
extensions/debug/views/default/index.php
View file @
68281d55
...
@@ -53,17 +53,15 @@ echo GridView::widget([
...
@@ -53,17 +53,15 @@ echo GridView::widget([
[
'class'
=>
'yii\grid\SerialColumn'
],
[
'class'
=>
'yii\grid\SerialColumn'
],
[
[
'attribute'
=>
'tag'
,
'attribute'
=>
'tag'
,
'value'
=>
function
(
$data
)
'value'
=>
function
(
$data
)
{
{
return
Html
::
a
(
$data
[
'tag'
],
[
'view'
,
'tag'
=>
$data
[
'tag'
]]);
return
Html
::
a
(
$data
[
'tag'
],
[
'view'
,
'tag'
=>
$data
[
'tag'
]]);
},
},
'format'
=>
'html'
,
'format'
=>
'html'
,
],
],
[
[
'attribute'
=>
'time'
,
'attribute'
=>
'time'
,
'value'
=>
function
(
$data
)
use
(
$timeFormatter
)
'value'
=>
function
(
$data
)
use
(
$timeFormatter
)
{
{
return
$timeFormatter
->
asDateTime
(
$data
[
'time'
],
'short'
);
return
$timeFormatter
->
asDateTime
(
$data
[
'time'
],
'H:i_j.M'
);
},
},
],
],
'ip'
,
'ip'
,
...
@@ -75,7 +73,7 @@ echo GridView::widget([
...
@@ -75,7 +73,7 @@ echo GridView::widget([
if
(
$dbPanel
->
isQueryCountCritical
(
$data
[
'sqlCount'
]))
{
if
(
$dbPanel
->
isQueryCountCritical
(
$data
[
'sqlCount'
]))
{
$content
=
Html
::
tag
(
'b'
,
$data
[
'sqlCount'
])
.
' '
.
Html
::
tag
(
'span'
,
''
,
[
'class'
=>
'glyphicon glyphicon-exclamation-sign'
]);
$content
=
Html
::
tag
(
'b'
,
$data
[
'sqlCount'
])
.
' '
.
Html
::
tag
(
'span'
,
''
,
[
'class'
=>
'glyphicon glyphicon-exclamation-sign'
]);
return
Html
::
a
(
$content
,
[
'view'
,
'panel'
=>
'db'
,
'tag'
=>
$data
[
'tag'
]],
[
return
Html
::
a
(
$content
,
[
'view'
,
'panel'
=>
'db'
,
'tag'
=>
$data
[
'tag'
]],
[
'title'
=>
'Too many queries. Allowed count is '
.
$dbPanel
->
criticalQueryThreshold
,
'title'
=>
'Too many queries. Allowed count is '
.
$dbPanel
->
criticalQueryThreshold
,
]);
]);
...
@@ -92,8 +90,7 @@ echo GridView::widget([
...
@@ -92,8 +90,7 @@ echo GridView::widget([
],
],
[
[
'attribute'
=>
'ajax'
,
'attribute'
=>
'ajax'
,
'value'
=>
function
(
$data
)
'value'
=>
function
(
$data
)
{
{
return
$data
[
'ajax'
]
?
'Yes'
:
'No'
;
return
$data
[
'ajax'
]
?
'Yes'
:
'No'
;
},
},
'filter'
=>
[
'No'
,
'Yes'
],
'filter'
=>
[
'No'
,
'Yes'
],
...
...
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