From 9193e4777ce71b4f5e84ae32cae2dd05332fe1b1 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 10 Aug 2013 07:56:40 -0400 Subject: [PATCH] Removed yii\debug\Module::enabled. --- apps/basic/config/web.php | 17 +++++++++-------- framework/yii/debug/Module.php | 13 ++++++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/basic/config/web.php b/apps/basic/config/web.php index 7622bc3..1433a64 100644 --- a/apps/basic/config/web.php +++ b/apps/basic/config/web.php @@ -1,15 +1,8 @@ 'bootstrap', 'basePath' => dirname(__DIR__), - 'preload' => array('debug'), - 'modules' => array( - 'debug' => array( - 'class' => 'yii\debug\Module', - 'enabled' => YII_ENV_DEV, - ), - ), 'components' => array( 'cache' => array( 'class' => 'yii\caching\FileCache', @@ -32,3 +25,11 @@ return array( ), 'params' => require(__DIR__ . '/params.php'), ); + +if (YII_ENV_DEV) { + $config['preload'][] = 'debug'; + $config['modules']['debug'] = 'yii\debug\Module'; + $config['modules']['gii'] = 'yii\gii\Module'; +} + +return $config; diff --git a/framework/yii/debug/Module.php b/framework/yii/debug/Module.php index 0d31bd3..1d0a460 100644 --- a/framework/yii/debug/Module.php +++ b/framework/yii/debug/Module.php @@ -25,7 +25,9 @@ class Module extends \yii\base\Module * by localhost. */ public $allowedIPs = array('127.0.0.1', '::1'); - + /** + * @var string the namespace that controller classes are in. + */ public $controllerNamespace = 'yii\debug\controllers'; /** * @var LogTarget @@ -39,15 +41,16 @@ 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'; + /** + * @var integer the maximum number of debug data files to keep. If there are more files generated, + * the oldest ones will be removed. + */ public $historySize = 50; - public $enabled = true; + public function init() { parent::init(); - if (!$this->enabled) { - return; - } $this->dataPath = Yii::getAlias($this->dataPath); $this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this); Yii::$app->getView()->on(View::EVENT_END_BODY, array($this, 'renderToolbar'));