Skip to content

Commit

Permalink
Merge pull request #5295 from najdanovicivan/toolbar-vars
Browse files Browse the repository at this point in the history
Toolbar - Make it possible to turn off var data collection
  • Loading branch information
lonnieezell authored Nov 10, 2021
2 parents 96df6a8 + 395f71f commit 903647c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Config/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ class Toolbar extends BaseConfig
Events::class,
];

/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be colleted. Usefull to
* avoid high memory usage when there are lots of data passed to the view.
*
* @var bool
*/
public $collectVarData = true;

/**
* --------------------------------------------------------------------------
* Max History
Expand Down
4 changes: 4 additions & 0 deletions system/Debug/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ protected function structureTimelineData(array $elements): array
*/
protected function collectVarData(): array
{
if (! ($this->config->collectVarData ?? true)) {
return [];
}

$data = [];

foreach ($this->collectors as $collector) {
Expand Down

0 comments on commit 903647c

Please sign in to comment.