Skip to content

Commit

Permalink
Dont update config
Browse files Browse the repository at this point in the history
Should fix config caching + concurrent requests.
  • Loading branch information
barryvdh committed Apr 16, 2016
1 parent 72acfb1 commit 765bffc
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/LaravelDebugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ class LaravelDebugbar extends DebugBar
*/
protected $booted = false;

/**
* True when enabled, false disabled an null for still unknown
*
* @var bool
*/
protected $enabled = null;

/**
* True when this is a Lumen application
*
Expand All @@ -95,7 +102,8 @@ public function __construct($app = null)
*/
public function enable()
{
$this->app['config']->set('debugbar.enabled', true);
$this->enabled = true;

if (!$this->booted) {
$this->boot();
}
Expand Down Expand Up @@ -580,10 +588,6 @@ public function modifyResponse(Request $request, Response $response)
}
}


// Stop further rendering (on subrequests etc)
$this->disable();

return $response;
}

Expand All @@ -593,7 +597,11 @@ public function modifyResponse(Request $request, Response $response)
*/
public function isEnabled()
{
return value($this->app['config']->get('debugbar.enabled'));
if ($this->enabled === null) {
$this->enabled = value($this->app['config']->get('debugbar.enabled'));
}

return $this->enabled;
}

/**
Expand Down Expand Up @@ -697,7 +705,7 @@ public function injectDebugbar(Response $response)
*/
public function disable()
{
$this->app['config']->set('debugbar.enabled', false);
$this->enabled = false;
}

/**
Expand Down

0 comments on commit 765bffc

Please sign in to comment.