mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-08-07 10:01:47 -04:00
Added JayBizzle/Laravel-Crawler-Detect to improve the error logs
This commit is contained in:
parent
06cce87d67
commit
60ce97fe79
@ -3,11 +3,13 @@
|
|||||||
use Redirect;
|
use Redirect;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Crawler;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Illuminate\Http\Exception\HttpResponseException;
|
use Illuminate\Http\Exception\HttpResponseException;
|
||||||
use Illuminate\Auth\Access\AuthorizationException;
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,10 +41,14 @@ class Handler extends ExceptionHandler
|
|||||||
public function report(Exception $e)
|
public function report(Exception $e)
|
||||||
{
|
{
|
||||||
// don't show these errors in the logs
|
// don't show these errors in the logs
|
||||||
if ($e instanceof HttpResponseException) {
|
if ($e instanceof NotFoundHttpException) {
|
||||||
|
if (Crawler::isCrawler()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} elseif ($e instanceof HttpResponseException) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils::isNinja() && ! Utils::isTravis()) {
|
if (Utils::isNinja() && ! Utils::isTravis()) {
|
||||||
Utils::logError(Utils::getErrorString($e));
|
Utils::logError(Utils::getErrorString($e));
|
||||||
return false;
|
return false;
|
||||||
@ -83,7 +89,7 @@ class Handler extends ExceptionHandler
|
|||||||
'error' => get_class($e),
|
'error' => get_class($e),
|
||||||
'hideHeader' => true,
|
'hideHeader' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
return response()->view('error', $data);
|
return response()->view('error', $data);
|
||||||
} else {
|
} else {
|
||||||
return parent::render($request, $e);
|
return parent::render($request, $e);
|
||||||
|
@ -80,7 +80,8 @@
|
|||||||
"collizo4sky/omnipay-wepay": "dev-additional-calls",
|
"collizo4sky/omnipay-wepay": "dev-additional-calls",
|
||||||
"barryvdh/laravel-ide-helper": "~2.2",
|
"barryvdh/laravel-ide-helper": "~2.2",
|
||||||
"barryvdh/laravel-debugbar": "~2.2",
|
"barryvdh/laravel-debugbar": "~2.2",
|
||||||
"fzaninotto/faker": "^1.5"
|
"fzaninotto/faker": "^1.5",
|
||||||
|
"jaybizzle/laravel-crawler-detect": "1.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~4.0",
|
"phpunit/phpunit": "~4.0",
|
||||||
|
101
composer.lock
generated
101
composer.lock
generated
@ -4,8 +4,8 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "12e15e592f20359ad1085b77289bcaaa",
|
"hash": "58fb4c4de809dbd2c62e2701e4c31b12",
|
||||||
"content-hash": "6eafb74ed8d18816511ecbca4498304b",
|
"content-hash": "308faa59f58a34174062714c7c9c5c48",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "agmscode/omnipay-agms",
|
"name": "agmscode/omnipay-agms",
|
||||||
@ -2727,6 +2727,103 @@
|
|||||||
],
|
],
|
||||||
"time": "2015-04-20 18:58:01"
|
"time": "2015-04-20 18:58:01"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "jaybizzle/crawler-detect",
|
||||||
|
"version": "v1.2.13",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/JayBizzle/Crawler-Detect.git",
|
||||||
|
"reference": "c91439a41bda3f9eec50c13118b55ad0478fb172"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/c91439a41bda3f9eec50c13118b55ad0478fb172",
|
||||||
|
"reference": "c91439a41bda3f9eec50c13118b55ad0478fb172",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "*"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Jaybizzle\\CrawlerDetect\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mark Beech",
|
||||||
|
"email": "m@rkbee.ch",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent",
|
||||||
|
"homepage": "https://github.com/JayBizzle/Crawler-Detect/",
|
||||||
|
"keywords": [
|
||||||
|
"crawler",
|
||||||
|
"crawler detect",
|
||||||
|
"crawler detector",
|
||||||
|
"crawlerdetect",
|
||||||
|
"php crawler detect"
|
||||||
|
],
|
||||||
|
"time": "2016-08-09 17:10:52"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "jaybizzle/laravel-crawler-detect",
|
||||||
|
"version": "v1.0.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/JayBizzle/Laravel-Crawler-Detect.git",
|
||||||
|
"reference": "58d1f788b68e622b860112584430dd549ad2d3d3"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/JayBizzle/Laravel-Crawler-Detect/zipball/58d1f788b68e622b860112584430dd549ad2d3d3",
|
||||||
|
"reference": "58d1f788b68e622b860112584430dd549ad2d3d3",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"jaybizzle/crawler-detect": "1.*",
|
||||||
|
"php": ">=5.4.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"orchestra/testbench": "3.0.*"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Jaybizzle\\LaravelCrawlerDetect\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mark Beech",
|
||||||
|
"email": "mbeech@mark-beech.co.uk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A Laravel package to detect web crawlers via user agents",
|
||||||
|
"homepage": "http://github.com/JayBizzle/Laravel-Crawler-Detect",
|
||||||
|
"keywords": [
|
||||||
|
"bot",
|
||||||
|
"crawler",
|
||||||
|
"detect",
|
||||||
|
"laravel",
|
||||||
|
"spider",
|
||||||
|
"user-agent"
|
||||||
|
],
|
||||||
|
"time": "2015-08-12 20:38:34"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "jeremeamia/SuperClosure",
|
"name": "jeremeamia/SuperClosure",
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
|
@ -154,6 +154,7 @@ return [
|
|||||||
'Jlapp\Swaggervel\SwaggervelServiceProvider',
|
'Jlapp\Swaggervel\SwaggervelServiceProvider',
|
||||||
'Maatwebsite\Excel\ExcelServiceProvider',
|
'Maatwebsite\Excel\ExcelServiceProvider',
|
||||||
Websight\GcsProvider\CloudStorageServiceProvider::class,
|
Websight\GcsProvider\CloudStorageServiceProvider::class,
|
||||||
|
'Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application Service Providers...
|
* Application Service Providers...
|
||||||
@ -255,7 +256,8 @@ return [
|
|||||||
'Socialite' => 'Laravel\Socialite\Facades\Socialite',
|
'Socialite' => 'Laravel\Socialite\Facades\Socialite',
|
||||||
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
|
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
|
||||||
'PushNotification' => 'Davibennun\LaravelPushNotification\Facades\PushNotification',
|
'PushNotification' => 'Davibennun\LaravelPushNotification\Facades\PushNotification',
|
||||||
|
'Crawler' => 'Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect',
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user