Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php namespace Barryvdh\Debugbar;
|
||||
|
||||
use Barryvdh\Debugbar\DataCollector\AuthCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\CacheCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\EventCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\FilesCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\GateCollector;
|
||||
@@ -9,13 +10,14 @@ use Barryvdh\Debugbar\DataCollector\LogsCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\MultiAuthCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\QueryCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\SessionCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\SymfonyRequestCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\RequestCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\ViewCollector;
|
||||
use Barryvdh\Debugbar\Storage\FilesystemStorage;
|
||||
use DebugBar\Bridge\MonologCollector;
|
||||
use DebugBar\Bridge\SwiftMailer\SwiftLogCollector;
|
||||
use DebugBar\Bridge\SwiftMailer\SwiftMailCollector;
|
||||
use DebugBar\DataCollector\ConfigCollector;
|
||||
use DebugBar\DataCollector\DataCollectorInterface;
|
||||
use DebugBar\DataCollector\ExceptionsCollector;
|
||||
use DebugBar\DataCollector\MemoryCollector;
|
||||
use DebugBar\DataCollector\MessagesCollector;
|
||||
@@ -124,7 +126,7 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
/** @var Application $app */
|
||||
$app = $this->app;
|
||||
|
||||
|
||||
// Set custom error handler
|
||||
if ($app['config']->get('debugbar.error_handler' , false)) {
|
||||
set_error_handler([$this, 'handleError']);
|
||||
@@ -222,7 +224,7 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
if (!$this->isLumen() && $this->shouldCollect('route')) {
|
||||
try {
|
||||
$this->addCollector($this->app->make('Barryvdh\Debugbar\DataCollector\IlluminateRouteCollector'));
|
||||
$this->addCollector($this->app->make('Barryvdh\Debugbar\DataCollector\RouteCollector'));
|
||||
} catch (\Exception $e) {
|
||||
$this->addThrowable(
|
||||
new Exception(
|
||||
@@ -317,6 +319,9 @@ class LaravelDebugbar extends DebugBar
|
||||
try {
|
||||
$db->listen(
|
||||
function ($query, $bindings = null, $time = null, $connectionName = null) use ($db, $queryCollector) {
|
||||
if (!$this->shouldCollect('db', true)) {
|
||||
return; // Issue 776 : We've turned off collecting after the listener was attached
|
||||
}
|
||||
// Laravel 5.2 changed the way some core events worked. We must account for
|
||||
// the first argument being an "event object", where arguments are passed
|
||||
// via object properties, instead of individual arguments.
|
||||
@@ -436,13 +441,8 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
if ($this->shouldCollect('auth', false)) {
|
||||
try {
|
||||
if($this->checkVersion('5.2')) {
|
||||
// fix for compatibility with Laravel 5.2.*
|
||||
$guards = array_keys($this->app['config']->get('auth.guards'));
|
||||
$authCollector = new MultiAuthCollector($app['auth'], $guards);
|
||||
} else {
|
||||
$authCollector = new AuthCollector($app['auth']);
|
||||
}
|
||||
$guards = array_keys($this->app['config']->get('auth.guards', []));
|
||||
$authCollector = new MultiAuthCollector($app['auth'], $guards);
|
||||
|
||||
$authCollector->setShowName(
|
||||
$this->app['config']->get('debugbar.options.auth.show_name')
|
||||
@@ -466,6 +466,25 @@ class LaravelDebugbar extends DebugBar
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->shouldCollect('cache', false) && isset($this->app['events'])) {
|
||||
try {
|
||||
$collectValues = $this->app['config']->get('debugbar.options.cache.values', true);
|
||||
$startTime = $this->app['request']->server('REQUEST_TIME_FLOAT');
|
||||
$cacheCollector = new CacheCollector($startTime, $collectValues);
|
||||
$this->addCollector($cacheCollector);
|
||||
$this->app['events']->subscribe($cacheCollector);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->addThrowable(
|
||||
new Exception(
|
||||
'Cannot add CacheCollector to Laravel Debugbar: ' . $e->getMessage(),
|
||||
$e->getCode(),
|
||||
$e
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$renderer = $this->getJavascriptRenderer();
|
||||
$renderer->setIncludeVendors($this->app['config']->get('debugbar.include_vendors', true));
|
||||
$renderer->setBindAjaxHandlerToXHR($app['config']->get('debugbar.capture_ajax', true));
|
||||
@@ -478,6 +497,25 @@ class LaravelDebugbar extends DebugBar
|
||||
return $this->app['config']->get('debugbar.collectors.' . $name, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a data collector
|
||||
*
|
||||
* @param DataCollectorInterface $collector
|
||||
*
|
||||
* @throws DebugBarException
|
||||
* @return $this
|
||||
*/
|
||||
public function addCollector(DataCollectorInterface $collector)
|
||||
{
|
||||
parent::addCollector($collector);
|
||||
|
||||
if (method_exists($collector, 'useHtmlVarDumper')) {
|
||||
$collector->useHtmlVarDumper();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle silenced errors
|
||||
*
|
||||
@@ -580,7 +618,7 @@ class LaravelDebugbar extends DebugBar
|
||||
public function modifyResponse(Request $request, Response $response)
|
||||
{
|
||||
$app = $this->app;
|
||||
if ($app->runningInConsole() || !$this->isEnabled() || $this->isDebugbarRequest()) {
|
||||
if (!$this->isEnabled() || $this->isDebugbarRequest()) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -631,7 +669,7 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
if ($this->shouldCollect('symfony_request', true) && !$this->hasCollector('request')) {
|
||||
try {
|
||||
$this->addCollector(new SymfonyRequestCollector($request, $response, $sessionManager));
|
||||
$this->addCollector(new RequestCollector($request, $response, $sessionManager));
|
||||
} catch (\Exception $e) {
|
||||
$this->addThrowable(
|
||||
new Exception(
|
||||
@@ -712,7 +750,14 @@ class LaravelDebugbar extends DebugBar
|
||||
public function isEnabled()
|
||||
{
|
||||
if ($this->enabled === null) {
|
||||
$this->enabled = value($this->app['config']->get('debugbar.enabled'));
|
||||
$config = $this->app['config'];
|
||||
$configEnabled = value($config->get('debugbar.enabled'));
|
||||
|
||||
if ($configEnabled === null) {
|
||||
$configEnabled = $config->get('app.debug');
|
||||
}
|
||||
|
||||
$this->enabled = $configEnabled && !$this->app->runningInConsole() && !$this->app->environment('testing');
|
||||
}
|
||||
|
||||
return $this->enabled;
|
||||
@@ -970,7 +1015,7 @@ class LaravelDebugbar extends DebugBar
|
||||
case 'redis':
|
||||
$connection = $config->get('debugbar.storage.connection');
|
||||
$client = $this->app['redis']->connection($connection);
|
||||
if (is_a($client, 'Illuminate\Redis\Connections\PredisConnection', false)) {
|
||||
if (is_a($client, 'Illuminate\Redis\Connections\Connection', false)) {
|
||||
$client = $client->client();
|
||||
}
|
||||
$storage = new RedisStorage($client);
|
||||
@@ -1011,7 +1056,7 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
$headers = [];
|
||||
foreach ($collector->collect()['measures'] as $k => $m) {
|
||||
$headers[] = sprintf('%d=%F; "%s"', $k, $m['duration'], str_replace('"', "'", $m['label']));
|
||||
$headers[] = sprintf('%d=%F; "%s"', $k, $m['duration'] * 1000, str_replace('"', "'", $m['label']));
|
||||
}
|
||||
|
||||
$response->headers->set('Server-Timing', $headers, false);
|
||||
|
Reference in New Issue
Block a user