Permalink
Browse files

Laravel 5.5 upgrade

  • Loading branch information...
REBELinBLUE committed Jun 12, 2018
1 parent 4d33536 commit 2af49a19e3b0c6367330b2d1656ec2b99761556c
Showing with 905 additions and 1,220 deletions.
  1. +3 −1 .env.dist
  2. +1 −1 .github/ISSUE_TEMPLATE/BUG_REPORT.md
  3. +4 −6 .travis.yml
  4. +1 −1 README.md
  5. +0 −1 app/Console/Commands/InstallApp.php
  6. +2 −2 app/Console/Commands/Installer/Requirements.php
  7. +1 −1 app/Console/Commands/ResetApp.php
  8. +0 −1 app/Console/Commands/UpdateApp.php
  9. +11 −6 app/Console/Kernel.php
  10. +19 −84 app/Exceptions/Handler.php
  11. +1 −1 app/Http/Controllers/Auth/ResetPasswordController.php
  12. +1 −1 app/Http/Kernel.php
  13. +2 −2 app/Http/Middleware/EncryptCookies.php
  14. +2 −2 app/Http/Middleware/TrimStrings.php
  15. +32 −0 app/Http/Middleware/TrustProxies.php
  16. +2 −2 app/Http/Middleware/VerifyCsrfToken.php
  17. +2 −0 app/Providers/AppServiceProvider.php
  18. +0 −79 app/Providers/WhoopsServiceProvider.php
  19. +2 −2 app/View/Presenters/Presenter.php
  20. +4 −2 artisan
  21. +0 −34 bootstrap/autoload.php
  22. +30 −39 composer.json
  23. +708 −573 composer.lock
  24. +12 −13 config/app.php
  25. +4 −1 config/cache.php
  26. +11 −0 config/database.php
  27. +2 −2 config/filesystems.php
  28. +16 −1 config/session.php
  29. +0 −23 config/trustedproxy.php
  30. +1 −10 phpunit.xml.dist
  31. +9 −3 public/.htaccess
  32. +4 −1 public/index.php
  33. +1 −1 tests/Integration/AuthenticatedTestCase.php
  34. +1 −1 tests/Integration/WebhookControllerTest.php
  35. +2 −2 tests/Integration/WebhooksTest.php
  36. +0 −9 tests/Unit/Console/Commands/InstallAppTest.php
  37. +1 −1 tests/Unit/Console/Commands/Installer/RequirementsTest.php
  38. +1 −1 tests/Unit/Console/Commands/ResetAppTest.php
  39. +0 −10 tests/Unit/Console/Commands/UpdateAppTest.php
  40. +0 −143 tests/Unit/Exceptions/HandlerTest.php
  41. +7 −4 tests/Unit/Jobs/DeployProject/ScriptBuilderTest.php
  42. +5 −1 tests/Unit/Notifications/Configurable/DeploymentFinishedTestCase.php
  43. +0 −134 tests/Unit/Providers/WhoopsServiceProviderTest.php
  44. +0 −18 tests/Unit/data/Exceptions/Handler.yml
@@ -45,9 +45,11 @@ QUEUE_HOST=localhost
QUEUE_PORT=11300 #default for beanstalkd
CACHE_DRIVER=file
SESSION_DRIVER=file
IMAGE_DRIVER=gd
SESSION_DRIVER=file
SESSION_LIFETIME=120
# A comma separated list of proxies to trust or * for all
TRUSTED_PROXIES=
GITHUB_OAUTH_TOKEN=
@@ -7,7 +7,7 @@ about: Create a report to help us improve
Before submitting your issue, please make sure that you've checked all of the checkboxes below.
- [ ] You're running the [latest release](https://github.com/REBElinBLUE/deployer/releases/latest) version of Deployer.
- [ ] Ensure that you're running at least PHP 5.6.4, you can check this by running `php -v`
- [ ] Ensure that you're running at least PHP 7.0.8, you can check this by running `php -v`
- [ ] You've ran `composer install --no-dev` from the root of your installation.
- [ ] You've ran `npm install --production` from the root of your installation.
- [ ] You've ran `rm -rf bootstrap/cache/*` from the root of your installation.
@@ -3,8 +3,7 @@ sudo: false
language: php
php:
- 5.6
- 7.0
- 7.0.8
- 7.1
- 7.2
@@ -19,15 +18,15 @@ cache:
matrix:
include:
- php: 7.0
- php: 7.0.8
env: DB=mysql
services:
- mysql
- php: 7.0
- php: 7.0.8
env: DB=maria
addons:
mariadb: 10.1
- php: 7.0
- php: 7.0.8
env: DB=pgsql
addons:
postgresql: "9.3"
@@ -67,7 +66,6 @@ script:
- composer test:loc
# Clear the compiled file and then try to install without the dev dependencies to ensure everything still works
- travis_retry composer install --no-dev --no-interaction --prefer-dist --no-suggest --quiet
- php artisan optimize
- php artisan app:version
after_script:
@@ -11,7 +11,7 @@
[![StackShare](https://img.shields.io/badge/tech-stack-0690fa.svg?style=flat-square&label=Tech)](https://stackshare.io/REBELinBLUE/deployer)
[![Gitter](https://img.shields.io/badge/chat-on%20gitter-brightgreen.svg?style=flat-square&label=Chat)](https://gitter.im/REBELinBLUE/deployer)
Deployer is a PHP Application deployment system powered by [Laravel 5.4](http://laravel.com), written & maintained by [Stephen Ball](https://github.com/REBELinBLUE).
Deployer is a PHP Application deployment system powered by [Laravel 5.5](http://laravel.com), written & maintained by [Stephen Ball](https://github.com/REBELinBLUE).
Check out the [releases](https://github.com/REBELinBLUE/deployer/releases), [license](/LICENSE.md), [screenshots](https://github.com/REBELinBLUE/deployer/wiki/Screenshots) and [contribution guidelines](/.github/CONTRIBUTING.md).
@@ -239,7 +239,6 @@ protected function clearCaches()
protected function optimize()
{
if (!$this->laravel->environment('local')) {
$this->call('optimize', ['--force' => true]);
$this->call('config:cache');
$this->call('route:cache');
}
@@ -110,8 +110,8 @@ public function check(Command $console)
private function versionCheck()
{
// Check PHP version:
if (!version_compare(PHP_VERSION, '5.6.4', '>=')) {
$this->console->error('PHP 5.6.4 or higher is required');
if (!version_compare(PHP_VERSION, '7.0.8', '>=')) {
$this->console->error('PHP 7.0.8 or higher is required');
$this->errors = true;
}
}
@@ -80,7 +80,7 @@ protected function resetDatabase()
$this->callSilent('migrate', ['--force' => true]);
$this->callSilent('app:update', ['--no-backup' => true]);
$this->call('migrate:fresh', ['--seed' => true, '--force' => true]);
$this->call('migrate:refresh', ['--seed' => true, '--force' => true]);
}
/**
@@ -163,7 +163,6 @@ protected function clearCaches()
protected function optimize()
{
if (!$this->laravel->environment('local')) {
$this->call('optimize', ['--force' => true]);
$this->call('config:cache');
$this->call('route:cache');
}
@@ -19,7 +19,6 @@
use REBELinBLUE\Deployer\Console\Commands\ResetApp;
use REBELinBLUE\Deployer\Console\Commands\UpdateApp;
use REBELinBLUE\Deployer\Console\Commands\UpdateGitMirrors;
use Spatie\MigrateFresh\Commands\MigrateFresh;
/**
* Kernel class.
@@ -58,11 +57,6 @@ public function bootstrap()
// Only register the reset command on the local environment
if ($this->app->environment('local', 'testing')) {
$this->commands[] = ResetApp::class;
// Only register the migratefresh command when it is installed
if (class_exists(MigrateFresh::class, true)) {
$this->commands[] = MigrateFresh::class;
}
}
}
@@ -100,4 +94,15 @@ protected function schedule(Schedule $schedule)
->hourly()
->withoutOverlapping();
}
//
// /**
// * Register the commands for the application.
// *
// * @return void
// */
// protected function commands()
// {
// $this->load(__DIR__.'/Commands');
// require base_path('routes/console.php');
// }
}
@@ -2,128 +2,63 @@
namespace REBELinBLUE\Deployer\Exceptions;
use Exception;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\Response;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Whoops\Run as Whoops;
/**
* Exception handler.
*/
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
AuthenticationException::class,
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
TokenMismatchException::class,
ValidationException::class,
];
/**
* Exceptions which should not be handled by whoops.
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $skipWhoops = [
AuthenticationException::class,
AuthorizationException::class,
HttpResponseException::class,
ModelNotFoundException::class,
ValidationException::class,
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Render an exception into an HTTP response.
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Illuminate\Auth\AuthenticationException $exception
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($this->isHttpException($exception)) {
return $this->renderHttpException($exception);
}
// Use whoops if it is bound to the container and the exception is safe to pass to whoops
if ($this->container->bound(Whoops::class) && $this->isSafeToWhoops($exception)) {
return $this->renderExceptionWithWhoops($exception);
}
return parent::render($request, $exception);
}
/**
* Render an exception using Whoops.
*
* @param \Exception $exception
*
* @return \Illuminate\Http\Response
*/
protected function renderExceptionWithWhoops(Exception $exception)
{
/** @var Whoops $whoops */
$whoops = $this->container->make(Whoops::class);
$statusCode = 500;
if (method_exists($exception, 'getStatusCode')) {
$statusCode = $exception->getStatusCode();
}
$headers = [];
if (method_exists($exception, 'getHeaders')) {
$headers = $exception->getHeaders();
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return new Response(
$whoops->handleException($exception),
$statusCode,
$headers
);
return redirect()->guest(route('auth.login'));
}
/**
* Don't allow the exceptions which laravel handles specially to be converted to Whoops.
* Convert a validation exception into a JSON response.
*
* @param \Exception $exception
* @todo Remove this
*
* @return bool
*/
protected function isSafeToWhoops(Exception $exception)
{
return is_null(collect($this->skipWhoops)->first(function ($type) use ($exception) {
return $exception instanceof $type;
}));
}
/**
* Convert an authentication exception into an unauthenticated response.
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Validation\ValidationException $exception
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\JsonResponse
*/
protected function unauthenticated($request)
protected function invalidJson($request, ValidationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest(route('auth.login'));
return response()->json($exception->errors(), $exception->status);
}
}
@@ -35,7 +35,7 @@ protected function rules()
return [
'token' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed|min:6|zxcvbn:3,email',
'password' => 'required|confirmed|min:6',
];
}
}
@@ -2,7 +2,7 @@
namespace REBELinBLUE\Deployer\Http;
use Fideloper\Proxy\TrustProxies;
use REBELinBLUE\Deployer\Http\Middleware\TrustProxies;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
@@ -2,12 +2,12 @@
namespace REBELinBLUE\Deployer\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
/**
* Middleware to encrypt cookies.
*/
class EncryptCookies extends BaseEncrypter
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
@@ -2,12 +2,12 @@
namespace REBELinBLUE\Deployer\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
/**
* Middleware to trim string inputs.
*/
class TrimStrings extends BaseTrimmer
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
@@ -0,0 +1,32 @@
<?php
namespace REBELinBLUE\Deployer\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
/**
* Middleware to specify which proxies to trust
*/
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The current proxy header mappings.
*
* @var array
*/
protected $headers = [
Request::HEADER_FORWARDED => 'FORWARDED',
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
];
}
@@ -2,12 +2,12 @@
namespace REBELinBLUE\Deployer\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
/**
* Middleware to prevent CSRF.
*/
class VerifyCsrfToken extends BaseVerifier
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
@@ -7,6 +7,7 @@
use Clockwork\Support\Laravel\ClockworkServiceProvider;
use GrahamCampbell\HTMLMin\HTMLMinServiceProvider;
use GrahamCampbell\HTMLMin\Http\Middleware\MinifyMiddleware;
use Laracademy\Commands\MakeServiceProvider;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
use Laravel\Dusk\DuskServiceProvider;
@@ -34,6 +35,7 @@ class AppServiceProvider extends ServiceProvider
'local' => [
IdeHelperServiceProvider::class,
ClockworkServiceProvider::class,
MakeServiceProvider::class,
],
];
Oops, something went wrong.

0 comments on commit 2af49a1

Please sign in to comment.