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
d5cd8234
Commit
d5cd8234
authored
Jul 08, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor fixes.
parent
c0c97507
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
19 deletions
+27
-19
LogTarget.php
framework/yii/debug/LogTarget.php
+4
-2
DefaultController.php
framework/yii/debug/controllers/DefaultController.php
+11
-5
view.php
framework/yii/debug/views/default/view.php
+12
-12
No files found.
framework/yii/debug/LogTarget.php
View file @
d5cd8234
...
@@ -50,7 +50,8 @@ class LogTarget extends Target
...
@@ -50,7 +50,8 @@ class LogTarget extends Target
$manifest
=
json_decode
(
file_get_contents
(
$indexFile
),
true
);
$manifest
=
json_decode
(
file_get_contents
(
$indexFile
),
true
);
}
}
$request
=
Yii
::
$app
->
getRequest
();
$request
=
Yii
::
$app
->
getRequest
();
$manifest
[
$this
->
tag
]
=
array
(
$manifest
[
$this
->
tag
]
=
$summary
=
array
(
'tag'
=>
$this
->
tag
,
'url'
=>
$request
->
getAbsoluteUrl
(),
'url'
=>
$request
->
getAbsoluteUrl
(),
'ajax'
=>
$request
->
getIsAjax
(),
'ajax'
=>
$request
->
getIsAjax
(),
'method'
=>
$request
->
getMethod
(),
'method'
=>
$request
->
getMethod
(),
...
@@ -64,6 +65,7 @@ class LogTarget extends Target
...
@@ -64,6 +65,7 @@ class LogTarget extends Target
foreach
(
$this
->
module
->
panels
as
$id
=>
$panel
)
{
foreach
(
$this
->
module
->
panels
as
$id
=>
$panel
)
{
$data
[
$id
]
=
$panel
->
save
();
$data
[
$id
]
=
$panel
->
save
();
}
}
$data
[
'summary'
]
=
$summary
;
file_put_contents
(
$dataFile
,
json_encode
(
$data
));
file_put_contents
(
$dataFile
,
json_encode
(
$data
));
file_put_contents
(
$indexFile
,
json_encode
(
$manifest
));
file_put_contents
(
$indexFile
,
json_encode
(
$manifest
));
}
}
...
@@ -86,7 +88,7 @@ class LogTarget extends Target
...
@@ -86,7 +88,7 @@ class LogTarget extends Target
protected
function
gc
(
&
$manifest
)
protected
function
gc
(
&
$manifest
)
{
{
if
(
rand
(
0
,
100
)
<
5
&&
count
(
$manifest
)
>
$this
->
module
->
historySize
)
{
if
(
count
(
$manifest
)
>
$this
->
module
->
historySize
+
10
)
{
$n
=
count
(
$manifest
)
-
$this
->
module
->
historySize
;
$n
=
count
(
$manifest
)
-
$this
->
module
->
historySize
;
foreach
(
array_keys
(
$manifest
)
as
$tag
)
{
foreach
(
array_keys
(
$manifest
)
as
$tag
)
{
$file
=
$this
->
module
->
dataPath
.
"/
$tag
.json"
;
$file
=
$this
->
module
->
dataPath
.
"/
$tag
.json"
;
...
...
framework/yii/debug/controllers/DefaultController.php
View file @
d5cd8234
...
@@ -17,9 +17,15 @@ use yii\web\HttpException;
...
@@ -17,9 +17,15 @@ use yii\web\HttpException;
*/
*/
class
DefaultController
extends
Controller
class
DefaultController
extends
Controller
{
{
/** @var \yii\debug\Module */
public
$module
;
public
$layout
=
'main'
;
public
$layout
=
'main'
;
/**
* @var \yii\debug\Module
*/
public
$module
;
/**
* @var array the summary data (e.g. URL, time)
*/
public
$summary
;
public
function
actionIndex
()
public
function
actionIndex
()
{
{
...
@@ -34,7 +40,7 @@ class DefaultController extends Controller
...
@@ -34,7 +40,7 @@ class DefaultController extends Controller
$tags
=
array_keys
(
$this
->
getManifest
());
$tags
=
array_keys
(
$this
->
getManifest
());
$tag
=
reset
(
$tags
);
$tag
=
reset
(
$tags
);
}
}
$
meta
=
$
this
->
loadData
(
$tag
);
$this
->
loadData
(
$tag
);
if
(
isset
(
$this
->
module
->
panels
[
$panel
]))
{
if
(
isset
(
$this
->
module
->
panels
[
$panel
]))
{
$activePanel
=
$this
->
module
->
panels
[
$panel
];
$activePanel
=
$this
->
module
->
panels
[
$panel
];
}
else
{
}
else
{
...
@@ -42,7 +48,7 @@ class DefaultController extends Controller
...
@@ -42,7 +48,7 @@ class DefaultController extends Controller
}
}
return
$this
->
render
(
'view'
,
array
(
return
$this
->
render
(
'view'
,
array
(
'tag'
=>
$tag
,
'tag'
=>
$tag
,
'
meta'
=>
$meta
,
'
summary'
=>
$this
->
summary
,
'manifest'
=>
$this
->
getManifest
(),
'manifest'
=>
$this
->
getManifest
(),
'panels'
=>
$this
->
module
->
panels
,
'panels'
=>
$this
->
module
->
panels
,
'activePanel'
=>
$activePanel
,
'activePanel'
=>
$activePanel
,
...
@@ -93,7 +99,7 @@ class DefaultController extends Controller
...
@@ -93,7 +99,7 @@ class DefaultController extends Controller
unset
(
$this
->
module
->
panels
[
$id
]);
unset
(
$this
->
module
->
panels
[
$id
]);
}
}
}
}
return
$manifest
[
$tag
];
$this
->
summary
=
$data
[
'summary'
];
}
else
{
}
else
{
throw
new
HttpException
(
404
,
"Unable to find debug data tagged with '
$tag
'."
);
throw
new
HttpException
(
404
,
"Unable to find debug data tagged with '
$tag
'."
);
}
}
...
...
framework/yii/debug/views/default/view.php
View file @
d5cd8234
...
@@ -4,7 +4,7 @@ use yii\helpers\Html;
...
@@ -4,7 +4,7 @@ use yii\helpers\Html;
/**
/**
* @var \yii\base\View $this
* @var \yii\base\View $this
* @var array $
meta
* @var array $
summary
* @var string $tag
* @var string $tag
* @var array $manifest
* @var array $manifest
* @var \yii\debug\Panel[] $panels
* @var \yii\debug\Panel[] $panels
...
@@ -51,11 +51,11 @@ $this->title = 'Yii Debugger';
...
@@ -51,11 +51,11 @@ $this->title = 'Yii Debugger';
<ul
class=
"dropdown-menu"
>
<ul
class=
"dropdown-menu"
>
<?php
<?php
$count
=
0
;
$count
=
0
;
foreach
(
$manifest
as
$
tag2
=>
$meta2
)
{
foreach
(
$manifest
as
$
meta
)
{
$label
=
$meta
2
[
'method'
]
.
' '
.
$meta2
[
'url'
]
.
(
$meta2
[
'ajax'
]
?
' (AJAX)'
:
''
)
$label
=
$meta
[
'tag'
]
.
': '
.
$meta
[
'method'
]
.
' '
.
$meta
[
'url'
]
.
(
$meta
[
'ajax'
]
?
' (AJAX)'
:
''
)
.
', '
.
date
(
'Y-m-d h:i:s
a'
,
$meta2
[
'time'
])
.
', '
.
date
(
'Y-m-d h:i:s
a'
,
$meta
[
'time'
])
.
', '
.
$meta
2
[
'ip'
]
.
', '
.
$tag2
;
.
', '
.
$meta
[
'ip'
]
;
$url
=
array
(
'view'
,
'tag'
=>
$
tag2
);
$url
=
array
(
'view'
,
'tag'
=>
$
meta
[
'tag'
]
);
echo
'<li>'
.
Html
::
a
(
Html
::
encode
(
$label
),
$url
)
.
'</li>'
;
echo
'<li>'
.
Html
::
a
(
Html
::
encode
(
$label
),
$url
)
.
'</li>'
;
if
(
++
$count
>=
10
)
{
if
(
++
$count
>=
10
)
{
break
;
break
;
...
@@ -64,12 +64,12 @@ $this->title = 'Yii Debugger';
...
@@ -64,12 +64,12 @@ $this->title = 'Yii Debugger';
?>
?>
</ul>
</ul>
</div>
</div>
Debugging
:
<?php
echo
$summary
[
'tag'
];
?>
:
<?php
echo
$
meta
[
'method'
];
?>
<?php
echo
$
summary
[
'method'
];
?>
<?php
echo
Html
::
a
(
Html
::
encode
(
$
meta
[
'url'
]),
$meta
[
'url'
]
);
?>
<?php
echo
Html
::
a
(
Html
::
encode
(
$
summary
[
'url'
]),
$summary
[
'url'
],
array
(
'class'
=>
'label'
)
);
?>
<?php
echo
$
meta
[
'ajax'
]
?
' (AJAX)'
:
''
;
?>
<?php
echo
$
summary
[
'ajax'
]
?
' (AJAX)'
:
''
;
?>
at
<?php
echo
date
(
'Y-m-d h:i:s
a'
,
$meta
[
'time'
]);
?>
at
<?php
echo
date
(
'Y-m-d h:i:s
a'
,
$summary
[
'time'
]);
?>
by
<?php
echo
$
meta
[
'ip'
];
?>
by
<?php
echo
$
summary
[
'ip'
];
?>
</div>
</div>
<?php
echo
$activePanel
->
getDetail
();
?>
<?php
echo
$activePanel
->
getDetail
();
?>
</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