Skip to content

Commit b9d6745

Browse files
authored
Update to Laravel 5.5 (pterodactyl#814)
1 parent f9df463 commit b9d6745

35 files changed

+1033
-830
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ php:
44
- 7.0
55
- 7.1
66
- 7.2
7-
matrix:
8-
fast_finish: true
9-
allow_failures:
10-
- php: 7.2
117
sudo: false
128
cache:
139
directories:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
1515

1616
### Changed
1717
* Revoking the administrative status for an admin will revoke all authentication tokens currently assigned to their account.
18+
* Updated core framework to Laravel 5.5. This includes many dependency updates.
19+
* Certain AWS specific environment keys were changed, this should have minimal impact on users unless you specifically enabled AWS specific features. The renames are: `AWS_KEY -> AWS_ACCESS_KEY_ID`, `AWS_SECRET -> AWS_SECRET_ACCESS_KEY`, `AWS_REGION -> AWS_DEFAULT_REGION`
1820

1921
### Added
2022
* Added star indicators to user listing in Admin CP to indicate users who are set as a root admin.

app/Console/Commands/Maintenance/CleanServiceBackupFilesCommand.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
<?php
2-
/**
3-
* Pterodactyl - Panel
4-
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5-
*
6-
* This software is licensed under the terms of the MIT license.
7-
* https://opensource.org/licenses/MIT
8-
*/
92

103
namespace Pterodactyl\Console\Commands\Maintenance;
114

5+
use SplFileInfo;
126
use Carbon\Carbon;
137
use Illuminate\Console\Command;
148
use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
@@ -17,11 +11,6 @@ class CleanServiceBackupFilesCommand extends Command
1711
{
1812
const BACKUP_THRESHOLD_MINUTES = 5;
1913

20-
/**
21-
* @var \Carbon\Carbon
22-
*/
23-
protected $carbon;
24-
2514
/**
2615
* @var string
2716
*/
@@ -40,14 +29,12 @@ class CleanServiceBackupFilesCommand extends Command
4029
/**
4130
* CleanServiceBackupFilesCommand constructor.
4231
*
43-
* @param \Carbon\Carbon $carbon
4432
* @param \Illuminate\Contracts\Filesystem\Factory $filesystem
4533
*/
46-
public function __construct(Carbon $carbon, FilesystemFactory $filesystem)
34+
public function __construct(FilesystemFactory $filesystem)
4735
{
4836
parent::__construct();
4937

50-
$this->carbon = $carbon;
5138
$this->disk = $filesystem->disk();
5239
}
5340

@@ -58,11 +45,11 @@ public function handle()
5845
{
5946
$files = $this->disk->files('services/.bak');
6047

61-
collect($files)->each(function ($file) {
62-
$lastModified = $this->carbon->timestamp($this->disk->lastModified($file));
63-
if ($lastModified->diffInMinutes($this->carbon->now()) > self::BACKUP_THRESHOLD_MINUTES) {
64-
$this->disk->delete($file);
65-
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file]));
48+
collect($files)->each(function (SplFileInfo $file) {
49+
$lastModified = Carbon::createFromTimestamp($this->disk->lastModified($file->getPath()));
50+
if ($lastModified->diffInMinutes(Carbon::now()) > self::BACKUP_THRESHOLD_MINUTES) {
51+
$this->disk->delete($file->getPath());
52+
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file->getFilename()]));
6653
}
6754
});
6855
}

app/Console/Kernel.php

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,17 @@
33
namespace Pterodactyl\Console;
44

55
use Illuminate\Console\Scheduling\Schedule;
6-
use Pterodactyl\Console\Commands\InfoCommand;
7-
use Pterodactyl\Console\Commands\User\MakeUserCommand;
8-
use Pterodactyl\Console\Commands\User\DeleteUserCommand;
96
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
10-
use Pterodactyl\Console\Commands\Server\RebuildServerCommand;
11-
use Pterodactyl\Console\Commands\Location\MakeLocationCommand;
12-
use Pterodactyl\Console\Commands\User\DisableTwoFactorCommand;
13-
use Pterodactyl\Console\Commands\Environment\AppSettingsCommand;
14-
use Pterodactyl\Console\Commands\Location\DeleteLocationCommand;
15-
use Pterodactyl\Console\Commands\Schedule\ProcessRunnableCommand;
16-
use Pterodactyl\Console\Commands\Environment\EmailSettingsCommand;
17-
use Pterodactyl\Console\Commands\Environment\DatabaseSettingsCommand;
18-
use Pterodactyl\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
197

208
class Kernel extends ConsoleKernel
219
{
2210
/**
23-
* The Artisan commands provided by your application.
24-
*
25-
* @var array
11+
* Register the commands for the application.
2612
*/
27-
protected $commands = [
28-
AppSettingsCommand::class,
29-
CleanServiceBackupFilesCommand::class,
30-
DatabaseSettingsCommand::class,
31-
DeleteLocationCommand::class,
32-
DeleteUserCommand::class,
33-
DisableTwoFactorCommand::class,
34-
EmailSettingsCommand::class,
35-
InfoCommand::class,
36-
MakeLocationCommand::class,
37-
MakeUserCommand::class,
38-
ProcessRunnableCommand::class,
39-
RebuildServerCommand::class,
40-
];
13+
protected function commands()
14+
{
15+
$this->load(__DIR__ . '/Commands');
16+
}
4117

4218
/**
4319
* Define the application's command schedule.

app/Http/Controllers/Admin/PackController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function newTemplate()
163163
*/
164164
public function store(PackFormRequest $request)
165165
{
166-
if ($request->has('from_template')) {
166+
if ($request->filled('from_template')) {
167167
$pack = $this->templateUploadService->handle($request->input('egg_id'), $request->file('file_upload'));
168168
} else {
169169
$pack = $this->creationService->handle($request->normalize(), $request->file('file_upload'));

app/Http/Controllers/Admin/ServersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public function updateBuild(Request $request, Server $server)
524524
*/
525525
public function delete(Request $request, Server $server)
526526
{
527-
$this->deletionService->withForce($request->has('force_delete'))->handle($server);
527+
$this->deletionService->withForce($request->filled('force_delete'))->handle($server);
528528
$this->alert->success(trans('admin/server.alerts.server_deleted'))->flash();
529529

530530
return redirect()->route('admin.servers');

app/Http/Controllers/Auth/LoginController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public function __construct(
107107
*
108108
* @param \Illuminate\Http\Request $request
109109
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response
110+
*
111+
* @throws \Illuminate\Validation\ValidationException
110112
*/
111113
public function login(Request $request)
112114
{
@@ -115,8 +117,7 @@ public function login(Request $request)
115117

116118
if ($this->hasTooManyLoginAttempts($request)) {
117119
$this->fireLockoutEvent($request);
118-
119-
return $this->sendLockoutResponse($request);
120+
$this->sendLockoutResponse($request);
120121
}
121122

122123
try {

app/Http/Controllers/Base/SecurityController.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
11
<?php
2-
/**
3-
* Pterodactyl - Panel
4-
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>
5-
* Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com>.
6-
*
7-
* Permission is hereby granted, free of charge, to any person obtaining a copy
8-
* of this software and associated documentation files (the "Software"), to deal
9-
* in the Software without restriction, including without limitation the rights
10-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11-
* copies of the Software, and to permit persons to whom the Software is
12-
* furnished to do so, subject to the following conditions:
13-
*
14-
* The above copyright notice and this permission notice shall be included in all
15-
* copies or substantial portions of the Software.
16-
*
17-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23-
* SOFTWARE.
24-
*/
252

263
namespace Pterodactyl\Http\Controllers\Base;
274

app/Http/Kernel.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Pterodactyl\Http;
44

5-
use Fideloper\Proxy\TrustProxies;
65
use Illuminate\Auth\Middleware\Authorize;
76
use Illuminate\Auth\Middleware\Authenticate;
87
use Pterodactyl\Http\Middleware\TrimStrings;
8+
use Pterodactyl\Http\Middleware\TrustProxies;
99
use Illuminate\Session\Middleware\StartSession;
1010
use Pterodactyl\Http\Middleware\EncryptCookies;
1111
use Pterodactyl\Http\Middleware\VerifyCsrfToken;
@@ -23,6 +23,7 @@
2323
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
2424
use Pterodactyl\Http\Middleware\API\AuthenticateIPAccess;
2525
use Pterodactyl\Http\Middleware\Daemon\DaemonAuthenticate;
26+
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
2627
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
2728
use Pterodactyl\Http\Middleware\API\HasPermissionToResource;
2829
use Pterodactyl\Http\Middleware\Server\AuthenticateAsSubuser;
@@ -31,6 +32,7 @@
3132
use Pterodactyl\Http\Middleware\Server\DatabaseBelongsToServer;
3233
use Pterodactyl\Http\Middleware\Server\ScheduleBelongsToServer;
3334
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
35+
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
3436
use Pterodactyl\Http\Middleware\DaemonAuthenticate as OldDaemonAuthenticate;
3537

3638
class Kernel extends HttpKernel
@@ -42,9 +44,9 @@ class Kernel extends HttpKernel
4244
*/
4345
protected $middleware = [
4446
CheckForMaintenanceMode::class,
45-
EncryptCookies::class,
46-
AddQueuedCookiesToResponse::class,
47+
ValidatePostSize::class,
4748
TrimStrings::class,
49+
ConvertEmptyStringsToNull::class,
4850
TrustProxies::class,
4951
];
5052

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Pterodactyl\Http\Middleware;
4+
5+
use Illuminate\Http\Request;
6+
use Fideloper\Proxy\TrustProxies as Middleware;
7+
8+
class TrustProxies extends Middleware
9+
{
10+
/**
11+
* The trusted proxies for this application.
12+
*
13+
* @var array
14+
*/
15+
protected $proxies;
16+
17+
/**
18+
* The current proxy header mappings.
19+
*
20+
* @var array
21+
*/
22+
protected $headers = [
23+
Request::HEADER_FORWARDED => 'FORWARDED',
24+
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
25+
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
26+
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
27+
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
28+
];
29+
}

0 commit comments

Comments
 (0)