Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
parent
95e15d2c8a
commit
cbcf62086f
573 changed files with 4387 additions and 9411 deletions
|
@ -31,19 +31,8 @@ class AppSettingsCommand extends Command
|
|||
'sync' => 'Sync',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Console\Kernel
|
||||
*/
|
||||
protected $command;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Configure basic environment settings for the Panel.';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'p:environment:setup
|
||||
{--new-salt : Whether or not to generate a new salt for Hashids.}
|
||||
{--author= : The email that services created on this instance should be linked to.}
|
||||
|
@ -57,19 +46,14 @@ class AppSettingsCommand extends Command
|
|||
{--redis-port= : Port to connect to redis over.}
|
||||
{--settings-ui= : Enable or disable the settings UI.}';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $variables = [];
|
||||
protected array $variables = [];
|
||||
|
||||
/**
|
||||
* AppSettingsCommand constructor.
|
||||
*/
|
||||
public function __construct(Kernel $command)
|
||||
public function __construct(private Kernel $console)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->command = $command;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +61,7 @@ class AppSettingsCommand extends Command
|
|||
*
|
||||
* @throws \Pterodactyl\Exceptions\PterodactylException
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
if (empty(config('hashids.salt')) || $this->option('new-salt')) {
|
||||
$this->variables['HASHIDS_SALT'] = str_random(20);
|
||||
|
@ -98,13 +82,13 @@ class AppSettingsCommand extends Command
|
|||
$this->output->comment('The application URL MUST begin with https:// or http:// depending on if you are using SSL or not. If you do not include the scheme your emails and other content will link to the wrong location.');
|
||||
$this->variables['APP_URL'] = $this->option('url') ?? $this->ask(
|
||||
'Application URL',
|
||||
config('app.url', 'http://example.org')
|
||||
config('app.url', 'https://example.com')
|
||||
);
|
||||
|
||||
$this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference http://php.net/manual/en/timezones.php.');
|
||||
$this->output->comment('The timezone should match one of PHP\'s supported timezones. If you are unsure, please reference https://php.net/manual/en/timezones.php.');
|
||||
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
|
||||
'Application Timezone',
|
||||
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
|
||||
DateTimeZone::listIdentifiers(),
|
||||
config('app.timezone')
|
||||
);
|
||||
|
||||
|
@ -136,14 +120,16 @@ class AppSettingsCommand extends Command
|
|||
}
|
||||
|
||||
// Make sure session cookies are set as "secure" when using HTTPS
|
||||
if (strpos($this->variables['APP_URL'], 'https://') === 0) {
|
||||
if (str_starts_with($this->variables['APP_URL'], 'https://')) {
|
||||
$this->variables['SESSION_SECURE_COOKIE'] = 'true';
|
||||
}
|
||||
|
||||
$this->checkForRedis();
|
||||
$this->writeToEnvironment($this->variables);
|
||||
|
||||
$this->info($this->command->output());
|
||||
$this->info($this->console->output());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,24 +12,8 @@ class DatabaseSettingsCommand extends Command
|
|||
{
|
||||
use EnvironmentWriterTrait;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Console\Kernel
|
||||
*/
|
||||
protected $console;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Database\DatabaseManager
|
||||
*/
|
||||
protected $database;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Configure database settings for the Panel.';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'p:environment:database
|
||||
{--host= : The connection address for the MySQL server.}
|
||||
{--port= : The connection port for the MySQL server.}
|
||||
|
@ -37,30 +21,22 @@ class DatabaseSettingsCommand extends Command
|
|||
{--username= : Username to use when connecting.}
|
||||
{--password= : Password to use for this database.}';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $variables = [];
|
||||
protected array $variables = [];
|
||||
|
||||
/**
|
||||
* DatabaseSettingsCommand constructor.
|
||||
*/
|
||||
public function __construct(DatabaseManager $database, Kernel $console)
|
||||
public function __construct(private DatabaseManager $database, private Kernel $console)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->console = $console;
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle command execution.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\PterodactylException
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
$this->output->note('It is highly recommended to not use "localhost" as your database host as we have seen frequent socket connection issues. If you want to use a local connection you should be using "127.0.0.1".');
|
||||
$this->variables['DB_HOST'] = $this->option('host') ?? $this->ask(
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?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\Environment;
|
||||
|
||||
|
@ -17,19 +10,8 @@ class EmailSettingsCommand extends Command
|
|||
{
|
||||
use EnvironmentWriterTrait;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Set or update the email sending configuration for the Panel.';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'p:environment:mail
|
||||
{--driver= : The mail driver to use.}
|
||||
{--email= : Email address that messages from the Panel will originate from.}
|
||||
|
@ -41,19 +23,14 @@ class EmailSettingsCommand extends Command
|
|||
{--username=}
|
||||
{--password=}';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $variables = [];
|
||||
protected array $variables = [];
|
||||
|
||||
/**
|
||||
* EmailSettingsCommand constructor.
|
||||
*/
|
||||
public function __construct(ConfigRepository $config)
|
||||
public function __construct(private ConfigRepository $config)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,7 +47,7 @@ class EmailSettingsCommand extends Command
|
|||
'mail' => 'PHP\'s Internal Mail Function',
|
||||
'mailgun' => 'Mailgun Transactional Email',
|
||||
'mandrill' => 'Mandrill Transactional Email',
|
||||
'postmark' => 'Postmarkapp Transactional Email',
|
||||
'postmark' => 'Postmark Transactional Email',
|
||||
],
|
||||
$this->config->get('mail.driver', 'smtp')
|
||||
);
|
||||
|
|
Reference in a new issue