Commit b55ce764 by Qiang Xue

Fixes #1263: Fixed the issue that Gii and Debug modules might be affected by…

Fixes #1263: Fixed the issue that Gii and Debug modules might be affected by incompatible asset manager configuration
parent 9c542974
......@@ -4,6 +4,7 @@ Yii Framework 2 debug extension Change Log
2.0.0-rc under development
--------------------------
- Bug #1263: Fixed the issue that Gii and Debug modules might be affected by incompatible asset manager configuration (qiangxue)
- Enh #3088: The debug module will manage their own URL rules now (qiangxue)
- Enh #3103: debugger panel is now not displayed when printing a page (githubjeka)
- Enh #3108: Added `yii\debug\Module::enableDebugLogs` to disable logging debug logs by default (qiangxue)
......
......@@ -129,20 +129,21 @@ class Module extends \yii\base\Module implements BootstrapInterface
*/
public function beforeAction($action)
{
if (!parent::beforeAction($action)) {
return false;
}
if (!$this->enableDebugLogs) {
foreach (Yii::$app->getLog()->targets as $target) {
$target->enabled = false;
}
}
if (!parent::beforeAction($action)) {
return false;
}
// do not display debug toolbar when in debug view mode
Yii::$app->getView()->off(View::EVENT_END_BODY, [$this, 'renderToolbar']);
if ($this->checkAccess()) {
$this->resetGlobalSettings();
return true;
} elseif ($action->id === 'toolbar') {
// Accessing toolbar remotely is normal. Do not throw exception.
......@@ -153,6 +154,14 @@ class Module extends \yii\base\Module implements BootstrapInterface
}
/**
* Resets potentially incompatible global settings done in app config.
*/
protected function resetGlobalSettings()
{
Yii::$app->assetManager->bundles = [];
}
/**
* Renders mini-toolbar at the end of page body.
*
* @param \yii\base\Event $event
......
......@@ -4,6 +4,7 @@ Yii Framework 2 gii extension Change Log
2.0.0-rc under development
--------------------------
- Bug #1263: Fixed the issue that Gii and Debug modules might be affected by incompatible asset manager configuration (qiangxue)
- Enh #3088: The gii module will manage their own URL rules now (qiangxue)
......
......@@ -96,15 +96,29 @@ class Module extends \yii\base\Module implements BootstrapInterface
*/
public function beforeAction($action)
{
if (!parent::beforeAction($action)) {
return false;
}
if (!$this->checkAccess()) {
throw new ForbiddenHttpException('You are not allowed to access this page.');
}
foreach (array_merge($this->coreGenerators(), $this->generators) as $id => $config) {
$this->generators[$id] = Yii::createObject($config);
}
if ($this->checkAccess()) {
return parent::beforeAction($action);
} else {
throw new ForbiddenHttpException('You are not allowed to access this page.');
$this->resetGlobalSettings();
return true;
}
/**
* Resets potentially incompatible global settings done in app config.
*/
protected function resetGlobalSettings()
{
Yii::$app->assetManager->bundles = [];
}
/**
......
......@@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.0-rc under development
--------------------------
- Bug #1263: Fixed the issue that Gii and Debug modules might be affected by incompatible asset manager configuration (qiangxue)
- Bug #2563: Theming is not working if the path map of the theme contains ".." or "." in the paths (qiangxue)
- Bug #2801: Fixed the issue that GridView gets footer content before data cells content (ElisDN)
- Bug #2853: ActiveRecord did not handle resource-typed columns well (chris68, qiangxue)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment