Update to Laravel 5.5 (#814)

This commit is contained in:
Dane Everitt 2017-12-17 13:07:38 -06:00 committed by GitHub
parent f9df463d32
commit b9d67459b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1021 additions and 818 deletions

View file

@ -1,14 +1,8 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Console\Commands\Maintenance;
use SplFileInfo;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
@ -17,11 +11,6 @@ class CleanServiceBackupFilesCommand extends Command
{
const BACKUP_THRESHOLD_MINUTES = 5;
/**
* @var \Carbon\Carbon
*/
protected $carbon;
/**
* @var string
*/
@ -40,14 +29,12 @@ class CleanServiceBackupFilesCommand extends Command
/**
* CleanServiceBackupFilesCommand constructor.
*
* @param \Carbon\Carbon $carbon
* @param \Illuminate\Contracts\Filesystem\Factory $filesystem
*/
public function __construct(Carbon $carbon, FilesystemFactory $filesystem)
public function __construct(FilesystemFactory $filesystem)
{
parent::__construct();
$this->carbon = $carbon;
$this->disk = $filesystem->disk();
}
@ -58,11 +45,11 @@ class CleanServiceBackupFilesCommand extends Command
{
$files = $this->disk->files('services/.bak');
collect($files)->each(function ($file) {
$lastModified = $this->carbon->timestamp($this->disk->lastModified($file));
if ($lastModified->diffInMinutes($this->carbon->now()) > self::BACKUP_THRESHOLD_MINUTES) {
$this->disk->delete($file);
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file]));
collect($files)->each(function (SplFileInfo $file) {
$lastModified = Carbon::createFromTimestamp($this->disk->lastModified($file->getPath()));
if ($lastModified->diffInMinutes(Carbon::now()) > self::BACKUP_THRESHOLD_MINUTES) {
$this->disk->delete($file->getPath());
$this->info(trans('command/messages.maintenance.deleting_service_backup', ['file' => $file->getFilename()]));
}
});
}

View file

@ -3,41 +3,17 @@
namespace Pterodactyl\Console;
use Illuminate\Console\Scheduling\Schedule;
use Pterodactyl\Console\Commands\InfoCommand;
use Pterodactyl\Console\Commands\User\MakeUserCommand;
use Pterodactyl\Console\Commands\User\DeleteUserCommand;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Pterodactyl\Console\Commands\Server\RebuildServerCommand;
use Pterodactyl\Console\Commands\Location\MakeLocationCommand;
use Pterodactyl\Console\Commands\User\DisableTwoFactorCommand;
use Pterodactyl\Console\Commands\Environment\AppSettingsCommand;
use Pterodactyl\Console\Commands\Location\DeleteLocationCommand;
use Pterodactyl\Console\Commands\Schedule\ProcessRunnableCommand;
use Pterodactyl\Console\Commands\Environment\EmailSettingsCommand;
use Pterodactyl\Console\Commands\Environment\DatabaseSettingsCommand;
use Pterodactyl\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
* Register the commands for the application.
*/
protected $commands = [
AppSettingsCommand::class,
CleanServiceBackupFilesCommand::class,
DatabaseSettingsCommand::class,
DeleteLocationCommand::class,
DeleteUserCommand::class,
DisableTwoFactorCommand::class,
EmailSettingsCommand::class,
InfoCommand::class,
MakeLocationCommand::class,
MakeUserCommand::class,
ProcessRunnableCommand::class,
RebuildServerCommand::class,
];
protected function commands()
{
$this->load(__DIR__ . '/Commands');
}
/**
* Define the application's command schedule.