Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -19,13 +19,13 @@ class AppSettingsCommand extends Command
|
|||
{
|
||||
use EnvironmentWriterTrait;
|
||||
|
||||
const ALLOWED_CACHE_DRIVERS = [
|
||||
public const ALLOWED_CACHE_DRIVERS = [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'memcached' => 'Memcached',
|
||||
'file' => 'Filesystem',
|
||||
];
|
||||
|
||||
const ALLOWED_SESSION_DRIVERS = [
|
||||
public const ALLOWED_SESSION_DRIVERS = [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'memcached' => 'Memcached',
|
||||
'database' => 'MySQL Database',
|
||||
|
@ -33,7 +33,7 @@ class AppSettingsCommand extends Command
|
|||
'cookie' => 'Cookie',
|
||||
];
|
||||
|
||||
const ALLOWED_QUEUE_DRIVERS = [
|
||||
public const ALLOWED_QUEUE_DRIVERS = [
|
||||
'redis' => 'Redis (recommended)',
|
||||
'database' => 'MySQL Database',
|
||||
'sync' => 'Sync',
|
||||
|
@ -77,9 +77,6 @@ class AppSettingsCommand extends Command
|
|||
|
||||
/**
|
||||
* AppSettingsCommand constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Illuminate\Contracts\Console\Kernel $command
|
||||
*/
|
||||
public function __construct(ConfigRepository $config, Kernel $command)
|
||||
{
|
||||
|
@ -102,43 +99,45 @@ class AppSettingsCommand extends Command
|
|||
|
||||
$this->output->comment(trans('command/messages.environment.app.author_help'));
|
||||
$this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask(
|
||||
trans('command/messages.environment.app.author'), $this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
|
||||
);
|
||||
trans('command/messages.environment.app.author'),
|
||||
$this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
|
||||
);
|
||||
|
||||
$this->output->comment(trans('command/messages.environment.app.app_url_help'));
|
||||
$this->variables['APP_URL'] = $this->option('url') ?? $this->ask(
|
||||
trans('command/messages.environment.app.app_url'), $this->config->get('app.url', 'http://example.org')
|
||||
);
|
||||
trans('command/messages.environment.app.app_url'),
|
||||
$this->config->get('app.url', 'http://example.org')
|
||||
);
|
||||
|
||||
$this->output->comment(trans('command/messages.environment.app.timezone_help'));
|
||||
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
|
||||
trans('command/messages.environment.app.timezone'),
|
||||
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
|
||||
$this->config->get('app.timezone')
|
||||
);
|
||||
trans('command/messages.environment.app.timezone'),
|
||||
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
|
||||
$this->config->get('app.timezone')
|
||||
);
|
||||
|
||||
$selected = $this->config->get('cache.default', 'redis');
|
||||
$this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice(
|
||||
trans('command/messages.environment.app.cache_driver'),
|
||||
self::ALLOWED_CACHE_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
|
||||
);
|
||||
trans('command/messages.environment.app.cache_driver'),
|
||||
self::ALLOWED_CACHE_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
|
||||
);
|
||||
|
||||
$selected = $this->config->get('session.driver', 'redis');
|
||||
$this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice(
|
||||
trans('command/messages.environment.app.session_driver'),
|
||||
self::ALLOWED_SESSION_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
|
||||
);
|
||||
trans('command/messages.environment.app.session_driver'),
|
||||
self::ALLOWED_SESSION_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
|
||||
);
|
||||
|
||||
$selected = $this->config->get('queue.default', 'redis');
|
||||
$this->variables['QUEUE_CONNECTION'] = $this->option('queue') ?? $this->choice(
|
||||
trans('command/messages.environment.app.queue_driver'),
|
||||
self::ALLOWED_QUEUE_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
|
||||
);
|
||||
trans('command/messages.environment.app.queue_driver'),
|
||||
self::ALLOWED_QUEUE_DRIVERS,
|
||||
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
|
||||
);
|
||||
|
||||
if (! is_null($this->option('settings-ui'))) {
|
||||
if (!is_null($this->option('settings-ui'))) {
|
||||
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true';
|
||||
} else {
|
||||
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(trans('command/messages.environment.app.settings'), true) ? 'false' : 'true';
|
||||
|
@ -171,11 +170,12 @@ class AppSettingsCommand extends Command
|
|||
|
||||
$this->output->note(trans('command/messages.environment.app.using_redis'));
|
||||
$this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask(
|
||||
trans('command/messages.environment.app.redis_host'), $this->config->get('database.redis.default.host')
|
||||
);
|
||||
trans('command/messages.environment.app.redis_host'),
|
||||
$this->config->get('database.redis.default.host')
|
||||
);
|
||||
|
||||
$askForRedisPassword = true;
|
||||
if (! empty($this->config->get('database.redis.default.password'))) {
|
||||
if (!empty($this->config->get('database.redis.default.password'))) {
|
||||
$this->variables['REDIS_PASSWORD'] = $this->config->get('database.redis.default.password');
|
||||
$askForRedisPassword = $this->confirm(trans('command/messages.environment.app.redis_pass_defined'));
|
||||
}
|
||||
|
@ -183,8 +183,8 @@ class AppSettingsCommand extends Command
|
|||
if ($askForRedisPassword) {
|
||||
$this->output->comment(trans('command/messages.environment.app.redis_pass_help'));
|
||||
$this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
|
||||
trans('command/messages.environment.app.redis_password')
|
||||
);
|
||||
trans('command/messages.environment.app.redis_password')
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($this->variables['REDIS_PASSWORD'])) {
|
||||
|
@ -192,7 +192,8 @@ class AppSettingsCommand extends Command
|
|||
}
|
||||
|
||||
$this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask(
|
||||
trans('command/messages.environment.app.redis_port'), $this->config->get('database.redis.default.port')
|
||||
);
|
||||
trans('command/messages.environment.app.redis_port'),
|
||||
$this->config->get('database.redis.default.port')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,10 +57,6 @@ class DatabaseSettingsCommand extends Command
|
|||
|
||||
/**
|
||||
* DatabaseSettingsCommand constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Illuminate\Database\DatabaseManager $database
|
||||
* @param \Illuminate\Contracts\Console\Kernel $console
|
||||
*/
|
||||
public function __construct(ConfigRepository $config, DatabaseManager $database, Kernel $console)
|
||||
{
|
||||
|
@ -82,24 +78,28 @@ class DatabaseSettingsCommand extends Command
|
|||
{
|
||||
$this->output->note(trans('command/messages.environment.database.host_warning'));
|
||||
$this->variables['DB_HOST'] = $this->option('host') ?? $this->ask(
|
||||
trans('command/messages.environment.database.host'), $this->config->get('database.connections.mysql.host', '127.0.0.1')
|
||||
);
|
||||
trans('command/messages.environment.database.host'),
|
||||
$this->config->get('database.connections.mysql.host', '127.0.0.1')
|
||||
);
|
||||
|
||||
$this->variables['DB_PORT'] = $this->option('port') ?? $this->ask(
|
||||
trans('command/messages.environment.database.port'), $this->config->get('database.connections.mysql.port', 3306)
|
||||
);
|
||||
trans('command/messages.environment.database.port'),
|
||||
$this->config->get('database.connections.mysql.port', 3306)
|
||||
);
|
||||
|
||||
$this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask(
|
||||
trans('command/messages.environment.database.database'), $this->config->get('database.connections.mysql.database', 'panel')
|
||||
);
|
||||
trans('command/messages.environment.database.database'),
|
||||
$this->config->get('database.connections.mysql.database', 'panel')
|
||||
);
|
||||
|
||||
$this->output->note(trans('command/messages.environment.database.username_warning'));
|
||||
$this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask(
|
||||
trans('command/messages.environment.database.username'), $this->config->get('database.connections.mysql.username', 'pterodactyl')
|
||||
);
|
||||
trans('command/messages.environment.database.username'),
|
||||
$this->config->get('database.connections.mysql.username', 'pterodactyl')
|
||||
);
|
||||
|
||||
$askForMySQLPassword = true;
|
||||
if (! empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
|
||||
if (!empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
|
||||
$this->variables['DB_PASSWORD'] = $this->config->get('database.connections.mysql.password');
|
||||
$askForMySQLPassword = $this->confirm(trans('command/messages.environment.database.password_defined'));
|
||||
}
|
||||
|
|
|
@ -47,8 +47,6 @@ class EmailSettingsCommand extends Command
|
|||
|
||||
/**
|
||||
* EmailSettingsCommand constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*/
|
||||
public function __construct(ConfigRepository $config)
|
||||
{
|
||||
|
@ -65,13 +63,15 @@ class EmailSettingsCommand extends Command
|
|||
public function handle()
|
||||
{
|
||||
$this->variables['MAIL_DRIVER'] = $this->option('driver') ?? $this->choice(
|
||||
trans('command/messages.environment.mail.ask_driver'), [
|
||||
trans('command/messages.environment.mail.ask_driver'),
|
||||
[
|
||||
'smtp' => 'SMTP Server',
|
||||
'mail' => 'PHP\'s Internal Mail Function',
|
||||
'mailgun' => 'Mailgun Transactional Email',
|
||||
'mandrill' => 'Mandrill Transactional Email',
|
||||
'postmark' => 'Postmarkapp Transactional Email',
|
||||
], $this->config->get('mail.driver', 'smtp')
|
||||
],
|
||||
$this->config->get('mail.driver', 'smtp')
|
||||
);
|
||||
|
||||
$method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables';
|
||||
|
@ -80,16 +80,20 @@ class EmailSettingsCommand extends Command
|
|||
}
|
||||
|
||||
$this->variables['MAIL_FROM'] = $this->option('email') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_mail_from'), $this->config->get('mail.from.address')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_mail_from'),
|
||||
$this->config->get('mail.from.address')
|
||||
);
|
||||
|
||||
$this->variables['MAIL_FROM_NAME'] = $this->option('from') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_mail_name'), $this->config->get('mail.from.name')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_mail_name'),
|
||||
$this->config->get('mail.from.name')
|
||||
);
|
||||
|
||||
$this->variables['MAIL_ENCRYPTION'] = $this->option('encryption') ?? $this->choice(
|
||||
trans('command/messages.environment.mail.ask_encryption'), ['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'], $this->config->get('mail.encryption', 'tls')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_encryption'),
|
||||
['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'],
|
||||
$this->config->get('mail.encryption', 'tls')
|
||||
);
|
||||
|
||||
$this->writeToEnvironment($this->variables);
|
||||
|
||||
|
@ -103,20 +107,23 @@ class EmailSettingsCommand extends Command
|
|||
private function setupSmtpDriverVariables()
|
||||
{
|
||||
$this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_smtp_host'), $this->config->get('mail.host')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_smtp_host'),
|
||||
$this->config->get('mail.host')
|
||||
);
|
||||
|
||||
$this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_smtp_port'), $this->config->get('mail.port')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_smtp_port'),
|
||||
$this->config->get('mail.port')
|
||||
);
|
||||
|
||||
$this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_smtp_username'), $this->config->get('mail.username')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_smtp_username'),
|
||||
$this->config->get('mail.username')
|
||||
);
|
||||
|
||||
$this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret(
|
||||
trans('command/messages.environment.mail.ask_smtp_password')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_smtp_password')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,12 +132,14 @@ class EmailSettingsCommand extends Command
|
|||
private function setupMailgunDriverVariables()
|
||||
{
|
||||
$this->variables['MAILGUN_DOMAIN'] = $this->option('host') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_mailgun_domain'), $this->config->get('services.mailgun.domain')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_mailgun_domain'),
|
||||
$this->config->get('services.mailgun.domain')
|
||||
);
|
||||
|
||||
$this->variables['MAILGUN_SECRET'] = $this->option('password') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_mailgun_secret'), $this->config->get('services.mailgun.secret')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_mailgun_secret'),
|
||||
$this->config->get('services.mailgun.secret')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,8 +148,9 @@ class EmailSettingsCommand extends Command
|
|||
private function setupMandrillDriverVariables()
|
||||
{
|
||||
$this->variables['MANDRILL_SECRET'] = $this->option('password') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_mandrill_secret'), $this->config->get('services.mandrill.secret')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_mandrill_secret'),
|
||||
$this->config->get('services.mandrill.secret')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -152,7 +162,8 @@ class EmailSettingsCommand extends Command
|
|||
$this->variables['MAIL_HOST'] = 'smtp.postmarkapp.com';
|
||||
$this->variables['MAIL_PORT'] = 587;
|
||||
$this->variables['MAIL_USERNAME'] = $this->variables['MAIL_PASSWORD'] = $this->option('username') ?? $this->ask(
|
||||
trans('command/messages.environment.mail.ask_postmark_username'), $this->config->get('mail.username')
|
||||
);
|
||||
trans('command/messages.environment.mail.ask_postmark_username'),
|
||||
$this->config->get('mail.username')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,6 @@ class InfoCommand extends Command
|
|||
|
||||
/**
|
||||
* VersionCommand constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @param \Pterodactyl\Services\Helpers\SoftwareVersionService $versionService
|
||||
*/
|
||||
public function __construct(ConfigRepository $config, SoftwareVersionService $versionService)
|
||||
{
|
||||
|
@ -65,7 +62,7 @@ class InfoCommand extends Command
|
|||
$this->output->title('Application Configuration');
|
||||
$this->table([], [
|
||||
['Environment', $this->formatText($this->config->get('app.env'), $this->config->get('app.env') === 'production' ?: 'bg=red')],
|
||||
['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', ! $this->config->get('app.debug') ?: 'bg=red')],
|
||||
['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', !$this->config->get('app.debug') ?: 'bg=red')],
|
||||
['Installation URL', $this->config->get('app.url')],
|
||||
['Installation Directory', base_path()],
|
||||
['Timezone', $this->config->get('app.timezone')],
|
||||
|
@ -104,6 +101,7 @@ class InfoCommand extends Command
|
|||
*
|
||||
* @param string $value
|
||||
* @param string $opts
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function formatText($value, $opts = '')
|
||||
|
|
|
@ -42,9 +42,6 @@ class DeleteLocationCommand extends Command
|
|||
|
||||
/**
|
||||
* DeleteLocationCommand constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
|
||||
* @param \Pterodactyl\Services\Locations\LocationDeletionService $deletionService
|
||||
*/
|
||||
public function __construct(
|
||||
LocationDeletionService $deletionService,
|
||||
|
@ -66,8 +63,9 @@ class DeleteLocationCommand extends Command
|
|||
{
|
||||
$this->locations = $this->locations ?? $this->repository->all();
|
||||
$short = $this->option('short') ?? $this->anticipate(
|
||||
trans('command/messages.location.ask_short'), $this->locations->pluck('short')->toArray()
|
||||
);
|
||||
trans('command/messages.location.ask_short'),
|
||||
$this->locations->pluck('short')->toArray()
|
||||
);
|
||||
|
||||
$location = $this->locations->where('short', $short)->first();
|
||||
if (is_null($location)) {
|
||||
|
|
|
@ -33,8 +33,6 @@ class MakeLocationCommand extends Command
|
|||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Locations\LocationCreationService $creationService
|
||||
*/
|
||||
public function __construct(LocationCreationService $creationService)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
|
|||
|
||||
class CleanServiceBackupFilesCommand extends Command
|
||||
{
|
||||
const BACKUP_THRESHOLD_MINUTES = 5;
|
||||
public const BACKUP_THRESHOLD_MINUTES = 5;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -28,8 +28,6 @@ class CleanServiceBackupFilesCommand extends Command
|
|||
|
||||
/**
|
||||
* CleanServiceBackupFilesCommand constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Filesystem\Factory $filesystem
|
||||
*/
|
||||
public function __construct(FilesystemFactory $filesystem)
|
||||
{
|
||||
|
|
|
@ -19,13 +19,10 @@ class PruneOrphanedBackupsCommand extends Command
|
|||
*/
|
||||
protected $description = 'Marks all backups that have not completed in the last "n" minutes as being failed.';
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository
|
||||
*/
|
||||
public function handle(BackupRepository $repository)
|
||||
{
|
||||
$since = $this->option('since-minutes');
|
||||
if (! is_digit($since)) {
|
||||
if (!is_digit($since)) {
|
||||
throw new InvalidArgumentException('The --since-minutes option must be a valid numeric digit.');
|
||||
}
|
||||
|
||||
|
@ -34,7 +31,7 @@ class PruneOrphanedBackupsCommand extends Command
|
|||
->whereDate('created_at', '<=', CarbonImmutable::now()->subMinutes($since));
|
||||
|
||||
$count = $query->count();
|
||||
if (! $count) {
|
||||
if (!$count) {
|
||||
$this->info('There are no orphaned backups to be marked as failed.');
|
||||
|
||||
return;
|
||||
|
|
|
@ -25,8 +25,6 @@ class CleanOrphanedApiKeysCommand extends Command
|
|||
|
||||
/**
|
||||
* CleanOrphanedApiKeysCommand constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(ApiKeyRepositoryInterface $repository)
|
||||
{
|
||||
|
@ -44,10 +42,11 @@ class CleanOrphanedApiKeysCommand extends Command
|
|||
{
|
||||
$count = $this->repository->findCountWhere([['key_type', '=', ApiKey::TYPE_NONE]]);
|
||||
$continue = $this->confirm(
|
||||
'This action will remove ' . $count . ' keys from the database. Are you sure you wish to continue?', false
|
||||
'This action will remove ' . $count . ' keys from the database. Are you sure you wish to continue?',
|
||||
false
|
||||
);
|
||||
|
||||
if (! $continue) {
|
||||
if (!$continue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ class KeyGenerateCommand extends BaseKeyGenerateCommand
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! empty(config('app.key')) && $this->input->isInteractive()) {
|
||||
if (!empty(config('app.key')) && $this->input->isInteractive()) {
|
||||
$this->output->warning(trans('command/messages.key.warning'));
|
||||
if (! $this->confirm(trans('command/messages.key.confirm'))) {
|
||||
if (!$this->confirm(trans('command/messages.key.confirm'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $this->confirm(trans('command/messages.key.final_confirm'))) {
|
||||
if (!$this->confirm(trans('command/messages.key.final_confirm'))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class SeedCommand extends BaseSeedCommand
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->hasCompletedMigrations()) {
|
||||
if (!$this->hasCompletedMigrations()) {
|
||||
return $this->showMigrationWarning();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class UpCommand extends BaseUpCommand
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->hasCompletedMigrations()) {
|
||||
if (!$this->hasCompletedMigrations()) {
|
||||
return $this->showMigrationWarning();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ class ProcessRunnableCommand extends Command
|
|||
* never throw an exception out, otherwise you'll end up killing the entire run group causing
|
||||
* any other schedules to not process correctly.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Schedule $schedule
|
||||
* @see https://github.com/pterodactyl/panel/issues/2609
|
||||
*/
|
||||
protected function processSchedule(Schedule $schedule)
|
||||
|
|
|
@ -27,8 +27,6 @@ class BulkPowerActionCommand extends Command
|
|||
/**
|
||||
* Handle the bulk power request.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonPowerRepository $powerRepository
|
||||
* @param \Illuminate\Validation\Factory $validator
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function handle(DaemonPowerRepository $powerRepository, ValidatorFactory $validator)
|
||||
|
@ -58,7 +56,7 @@ class BulkPowerActionCommand extends Command
|
|||
}
|
||||
|
||||
$count = $this->getQueryBuilder($servers, $nodes)->count();
|
||||
if (! $this->confirm(trans('command/messages.server.power.confirm', ['action' => $action, 'count' => $count])) && $this->input->isInteractive()) {
|
||||
if (!$this->confirm(trans('command/messages.server.power.confirm', ['action' => $action, 'count' => $count])) && $this->input->isInteractive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -87,8 +85,6 @@ class BulkPowerActionCommand extends Command
|
|||
/**
|
||||
* Returns the query builder instance that will return the servers that should be affected.
|
||||
*
|
||||
* @param array $servers
|
||||
* @param array $nodes
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
protected function getQueryBuilder(array $servers, array $nodes)
|
||||
|
@ -97,11 +93,11 @@ class BulkPowerActionCommand extends Command
|
|||
->where('suspended', false)
|
||||
->where('installed', Server::STATUS_INSTALLED);
|
||||
|
||||
if (! empty($nodes) && ! empty($servers)) {
|
||||
if (!empty($nodes) && !empty($servers)) {
|
||||
$instance->whereIn('id', $servers)->orWhereIn('node_id', $nodes);
|
||||
} elseif (empty($nodes) && ! empty($servers)) {
|
||||
} elseif (empty($nodes) && !empty($servers)) {
|
||||
$instance->whereIn('id', $servers);
|
||||
} elseif (! empty($nodes) && empty($servers)) {
|
||||
} elseif (!empty($nodes) && empty($servers)) {
|
||||
$instance->whereIn('node_id', $nodes);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,6 @@ class BulkReinstallActionCommand extends Command
|
|||
|
||||
/**
|
||||
* BulkReinstallActionCommand constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonRepository
|
||||
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
|
||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||
*/
|
||||
public function __construct(
|
||||
DaemonServerRepository $daemonRepository,
|
||||
|
@ -71,7 +67,7 @@ class BulkReinstallActionCommand extends Command
|
|||
{
|
||||
$servers = $this->getServersToProcess();
|
||||
|
||||
if (! $this->confirm(trans('command/messages.server.reinstall.confirm')) && $this->input->isInteractive()) {
|
||||
if (!$this->confirm(trans('command/messages.server.reinstall.confirm')) && $this->input->isInteractive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,6 @@ class DeleteUserCommand extends Command
|
|||
|
||||
/**
|
||||
* DeleteUserCommand constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Users\UserDeletionService $deletionService
|
||||
*/
|
||||
public function __construct(UserDeletionService $deletionService)
|
||||
{
|
||||
|
@ -50,6 +48,7 @@ class DeleteUserCommand extends Command
|
|||
|
||||
/**
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function handle()
|
||||
|
@ -79,7 +78,7 @@ class DeleteUserCommand extends Command
|
|||
}
|
||||
|
||||
$this->table(['User ID', 'Email', 'Name'], $tableValues);
|
||||
if (! $deleteUser = $this->ask(trans('command/messages.user.select_search_user'))) {
|
||||
if (!$deleteUser = $this->ask(trans('command/messages.user.select_search_user'))) {
|
||||
return $this->handle();
|
||||
}
|
||||
} else {
|
||||
|
@ -92,7 +91,7 @@ class DeleteUserCommand extends Command
|
|||
$deleteUser = $results->first();
|
||||
}
|
||||
|
||||
if ($this->confirm(trans('command/messages.user.confirm_delete')) || ! $this->input->isInteractive()) {
|
||||
if ($this->confirm(trans('command/messages.user.confirm_delete')) || !$this->input->isInteractive()) {
|
||||
$this->deletionService->handle($deleteUser);
|
||||
$this->info(trans('command/messages.user.deleted'));
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ class DisableTwoFactorCommand extends Command
|
|||
|
||||
/**
|
||||
* DisableTwoFactorCommand constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(UserRepositoryInterface $repository)
|
||||
{
|
||||
|
|
|
@ -31,8 +31,6 @@ class MakeUserCommand extends Command
|
|||
|
||||
/**
|
||||
* MakeUserCommand constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Users\UserCreationService $creationService
|
||||
*/
|
||||
public function __construct(UserCreationService $creationService)
|
||||
{
|
||||
|
@ -55,7 +53,7 @@ class MakeUserCommand extends Command
|
|||
$name_first = $this->option('name-first') ?? $this->ask(trans('command/messages.user.ask_name_first'));
|
||||
$name_last = $this->option('name-last') ?? $this->ask(trans('command/messages.user.ask_name_last'));
|
||||
|
||||
if (is_null($password = $this->option('password')) && ! $this->option('no-password')) {
|
||||
if (is_null($password = $this->option('password')) && !$this->option('no-password')) {
|
||||
$this->warn(trans('command/messages.user.ask_password_help'));
|
||||
$this->line(trans('command/messages.user.ask_password_tip'));
|
||||
$password = $this->secret(trans('command/messages.user.ask_password'));
|
||||
|
|
|
@ -17,8 +17,6 @@ class Kernel extends ConsoleKernel
|
|||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
|
|
|
@ -9,8 +9,6 @@ trait RequiresDatabaseMigrations
|
|||
{
|
||||
/**
|
||||
* Checks if the migrations have finished running by comparing the last migration file.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasCompletedMigrations(): bool
|
||||
{
|
||||
|
@ -19,7 +17,7 @@ trait RequiresDatabaseMigrations
|
|||
|
||||
$files = $migrator->getMigrationFiles(database_path('migrations'));
|
||||
|
||||
if (! $migrator->repositoryExists()) {
|
||||
if (!$migrator->repositoryExists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -34,8 +32,6 @@ trait RequiresDatabaseMigrations
|
|||
* Throw a massive error into the console to hopefully catch the users attention and get
|
||||
* them to properly run the migrations rather than ignoring all of the other previous
|
||||
* errors...
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function showMigrationWarning(): int
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue