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
5af1e524
Commit
5af1e524
authored
Oct 17, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #999 from iJackUA/debug-panel-serialisation-fix
Debug panel : change json_encode/decode to serialise/unserialise
parents
802a89f0
5b86ec97
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
LogTarget.php
framework/yii/debug/LogTarget.php
+6
-6
DefaultController.php
framework/yii/debug/controllers/DefaultController.php
+4
-4
RequestPanel.php
framework/yii/debug/panels/RequestPanel.php
+1
-1
No files found.
framework/yii/debug/LogTarget.php
View file @
5af1e524
...
...
@@ -45,11 +45,11 @@ class LogTarget extends Target
if
(
!
is_dir
(
$path
))
{
mkdir
(
$path
);
}
$indexFile
=
"
$path
/index.
json
"
;
$indexFile
=
"
$path
/index.
php
"
;
if
(
!
is_file
(
$indexFile
))
{
$manifest
=
array
();
}
else
{
$manifest
=
json_decode
(
file_get_contents
(
$indexFile
),
true
);
$manifest
=
unserialize
(
file_get_contents
(
$indexFile
)
);
}
$request
=
Yii
::
$app
->
getRequest
();
$manifest
[
$this
->
tag
]
=
$summary
=
array
(
...
...
@@ -62,14 +62,14 @@ class LogTarget extends Target
);
$this
->
gc
(
$manifest
);
$dataFile
=
"
$path
/
{
$this
->
tag
}
.
json
"
;
$dataFile
=
"
$path
/
{
$this
->
tag
}
.
php
"
;
$data
=
array
();
foreach
(
$this
->
module
->
panels
as
$id
=>
$panel
)
{
$data
[
$id
]
=
$panel
->
save
();
}
$data
[
'summary'
]
=
$summary
;
file_put_contents
(
$dataFile
,
json_encod
e
(
$data
));
file_put_contents
(
$indexFile
,
json_encod
e
(
$manifest
));
file_put_contents
(
$dataFile
,
serializ
e
(
$data
));
file_put_contents
(
$indexFile
,
serializ
e
(
$manifest
));
}
/**
...
...
@@ -93,7 +93,7 @@ class LogTarget extends Target
if
(
count
(
$manifest
)
>
$this
->
module
->
historySize
+
10
)
{
$n
=
count
(
$manifest
)
-
$this
->
module
->
historySize
;
foreach
(
array_keys
(
$manifest
)
as
$tag
)
{
$file
=
$this
->
module
->
dataPath
.
"/
$tag
.
json
"
;
$file
=
$this
->
module
->
dataPath
.
"/
$tag
.
php
"
;
@
unlink
(
$file
);
unset
(
$manifest
[
$tag
]);
if
(
--
$n
<=
0
)
{
...
...
framework/yii/debug/controllers/DefaultController.php
View file @
5af1e524
...
...
@@ -74,9 +74,9 @@ class DefaultController extends Controller
protected
function
getManifest
()
{
if
(
$this
->
_manifest
===
null
)
{
$indexFile
=
$this
->
module
->
dataPath
.
'/index.
json
'
;
$indexFile
=
$this
->
module
->
dataPath
.
'/index.
php
'
;
if
(
is_file
(
$indexFile
))
{
$this
->
_manifest
=
array_reverse
(
json_decode
(
file_get_contents
(
$indexFile
),
true
),
true
);
$this
->
_manifest
=
array_reverse
(
unserialize
(
file_get_contents
(
$indexFile
)
),
true
);
}
else
{
$this
->
_manifest
=
array
();
}
...
...
@@ -88,8 +88,8 @@ class DefaultController extends Controller
{
$manifest
=
$this
->
getManifest
();
if
(
isset
(
$manifest
[
$tag
]))
{
$dataFile
=
$this
->
module
->
dataPath
.
"/
$tag
.
json
"
;
$data
=
json_decode
(
file_get_contents
(
$dataFile
),
true
);
$dataFile
=
$this
->
module
->
dataPath
.
"/
$tag
.
php
"
;
$data
=
unserialize
(
file_get_contents
(
$dataFile
)
);
foreach
(
$this
->
module
->
panels
as
$id
=>
$panel
)
{
if
(
isset
(
$data
[
$id
]))
{
$panel
->
tag
=
$tag
;
...
...
framework/yii/debug/panels/RequestPanel.php
View file @
5af1e524
...
...
@@ -151,7 +151,7 @@ EOD;
}
$rows
=
array
();
foreach
(
$values
as
$name
=>
$value
)
{
$rows
[]
=
'<tr><th style="width: 200px;">'
.
Html
::
encode
(
$name
)
.
'</th><td>'
.
Html
::
encode
(
var_export
(
$value
,
true
)
)
.
'</td></tr>'
;
$rows
[]
=
'<tr><th style="width: 200px;">'
.
Html
::
encode
(
$name
)
.
'</th><td>'
.
htmlspecialchars
(
var_export
(
$value
,
true
),
ENT_QUOTES
|
ENT_SUBSTITUTE
,
\Yii
::
$app
->
charset
,
TRUE
)
.
'</td></tr>'
;
}
$rows
=
implode
(
"
\n
"
,
$rows
);
return
<<<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