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
c7e40f5c
Commit
c7e40f5c
authored
May 08, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug toolbar WIP.
parent
b836665d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
125 additions
and
1 deletion
+125
-1
main.php
apps/bootstrap/protected/config/main.php
+5
-0
main.php
apps/bootstrap/protected/views/layouts/main.php
+1
-0
assets.php
framework/assets.php
+7
-0
yii.debug.js
framework/assets/yii.debug.js
+26
-0
yii.validation.js
framework/assets/yii.validation.js
+1
-1
Module.php
framework/debug/Module.php
+18
-0
Toolbar.php
framework/debug/Toolbar.php
+38
-0
DefaultController.php
framework/debug/controllers/DefaultController.php
+23
-0
Logger.php
framework/logging/Logger.php
+6
-0
No files found.
apps/bootstrap/protected/config/main.php
View file @
c7e40f5c
...
...
@@ -4,6 +4,11 @@ return array(
'id'
=>
'hello'
,
'basePath'
=>
dirname
(
__DIR__
),
'preload'
=>
array
(
'log'
),
'modules'
=>
array
(
'debug'
=>
array
(
'class'
=>
'yii\debug\Module'
,
)
),
'components'
=>
array
(
'cache'
=>
array
(
'class'
=>
'yii\caching\FileCache'
,
...
...
apps/bootstrap/protected/views/layouts/main.php
View file @
c7e40f5c
...
...
@@ -58,6 +58,7 @@ $this->registerAssetBundle('app');
</div>
<?php
$this
->
endBody
();
?>
</div>
<?php
$this
->
widget
(
'yii\debug\Toolbar'
);
?>
</body>
</html>
<?php
$this
->
endPage
();
?>
framework/assets.php
View file @
c7e40f5c
...
...
@@ -35,4 +35,11 @@ return array(
),
'depends'
=>
array
(
'yii'
),
),
'yii/debug'
=>
array
(
'sourcePath'
=>
__DIR__
.
'/assets'
,
'js'
=>
array
(
'yii.debug.js'
,
),
'depends'
=>
array
(
'yii'
),
),
);
framework/assets/yii.debug.js
0 → 100644
View file @
c7e40f5c
/**
* Yii debug module.
*
* This JavaScript module provides the functions needed by the Yii debug toolbar.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
yii
.
debug
=
(
function
(
$
)
{
return
{
load
:
function
(
id
,
url
)
{
$
.
ajax
({
url
:
url
,
//dataType: 'json',
success
:
function
(
data
)
{
var
$e
=
$
(
'#'
+
id
);
$e
.
html
(
data
);
}
});
}
};
})(
jQuery
);
framework/assets/yii.validation.js
View file @
c7e40f5c
/**
* Yii validation module.
*
* This JavaScript module provides the validation methods for the built-in valida
ot
rs.
* This JavaScript module provides the validation methods for the built-in valida
to
rs.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
...
...
framework/debug/Module.php
0 → 100644
View file @
c7e40f5c
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\debug
;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Module
extends
\yii\base\Module
{
public
$controllerNamespace
=
'yii\debug\controllers'
;
}
\ No newline at end of file
framework/debug/Toolbar.php
0 → 100644
View file @
c7e40f5c
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\debug
;
use
Yii
;
use
yii\base\Widget
;
use
yii\helpers\Html
;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Toolbar
extends
Widget
{
public
$debugAction
=
'debug'
;
public
$enabled
=
YII_DEBUG
;
public
function
run
()
{
if
(
$this
->
enabled
)
{
$id
=
'yii-debug-toolbar'
;
$url
=
Yii
::
$app
->
getUrlManager
()
->
createUrl
(
$this
->
debugAction
,
array
(
'tag'
=>
Yii
::
getLogger
()
->
tag
,
));
$this
->
view
->
registerJs
(
"yii.debug.load('
$id
', '
$url
');"
);
$this
->
view
->
registerAssetBundle
(
'yii/debug'
);
echo
Html
::
tag
(
'div'
,
''
,
array
(
'id'
=>
$id
,
'style'
=>
'display: none'
,
));
}
}
}
framework/debug/controllers/DefaultController.php
0 → 100644
View file @
c7e40f5c
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\debug\controllers
;
use
yii\web\Controller
;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
DefaultController
extends
Controller
{
public
function
actionIndex
(
$tag
)
{
echo
$tag
;
}
}
\ No newline at end of file
framework/logging/Logger.php
View file @
c7e40f5c
...
...
@@ -82,6 +82,11 @@ class Logger extends Component
* @var Router the log target router registered with this logger.
*/
public
$router
;
/**
* @var string a tag that uniquely identifies the current request. This can be used
* to differentiate the log messages for different requests.
*/
public
$tag
;
/**
* Initializes the logger by registering [[flush()]] as a shutdown function.
...
...
@@ -89,6 +94,7 @@ class Logger extends Component
public
function
init
()
{
parent
::
init
();
$this
->
tag
=
date
(
'Ymd-His'
,
microtime
(
true
));
register_shutdown_function
(
array
(
$this
,
'flush'
),
true
);
}
...
...
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