From fa9431c54d0786f4a00ae1da95d46908f64da9dd Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 14:12:15 -0800 Subject: [PATCH 1/7] Slightly cleanup --- .../PruneOrphanedBackupsCommand.php | 8 +- .../Migration/CleanOrphanedApiKeysCommand.php | 57 --------- .../Commands/Overrides/KeyGenerateCommand.php | 6 +- .../Commands/Overrides/SeedCommand.php | 8 +- app/Console/Commands/Overrides/UpCommand.php | 5 +- .../Server/BulkReinstallActionCommand.php | 109 ------------------ app/Console/Kernel.php | 9 +- resources/lang/en/command/messages.php | 5 - 8 files changed, 16 insertions(+), 191 deletions(-) delete mode 100644 app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php delete mode 100644 app/Console/Commands/Server/BulkReinstallActionCommand.php diff --git a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php index 77ad86ad4..4aef591a2 100644 --- a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php +++ b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php @@ -12,7 +12,7 @@ class PruneOrphanedBackupsCommand extends Command /** * @var string */ - protected $signature = 'p:maintenance:prune-backups {--since-minutes=30}'; + protected $signature = 'p:maintenance:prune-backups {--prune-age=}'; /** * @var string @@ -21,9 +21,9 @@ class PruneOrphanedBackupsCommand extends Command public function handle(BackupRepository $repository) { - $since = $this->option('since-minutes'); - if (!is_digit($since)) { - throw new InvalidArgumentException('The --since-minutes option must be a valid numeric digit.'); + $since = $this->option('prune-age') ?? config('backups.prune_age', 360); + if (!$since || !is_digit($since)) { + throw new InvalidArgumentException('The "--prune-age" argument must be a value greater than 0.'); } $query = $repository->getBuilder() diff --git a/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php b/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php deleted file mode 100644 index 7a7ff33a9..000000000 --- a/app/Console/Commands/Migration/CleanOrphanedApiKeysCommand.php +++ /dev/null @@ -1,57 +0,0 @@ -repository = $repository; - } - - /** - * Delete all orphaned API keys from the database when upgrading from 0.6 to 0.7. - * - * @return void|null - */ - public function handle() - { - $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 - ); - - if (!$continue) { - return null; - } - - $this->info('Deleting keys...'); - $this->repository->deleteWhere([['key_type', '=', ApiKey::TYPE_NONE]]); - $this->info('Keys were successfully deleted.'); - } -} diff --git a/app/Console/Commands/Overrides/KeyGenerateCommand.php b/app/Console/Commands/Overrides/KeyGenerateCommand.php index 8aa30a9e8..bc8a4edb6 100644 --- a/app/Console/Commands/Overrides/KeyGenerateCommand.php +++ b/app/Console/Commands/Overrides/KeyGenerateCommand.php @@ -13,12 +13,12 @@ class KeyGenerateCommand extends BaseKeyGenerateCommand public function handle() { if (!empty(config('app.key')) && $this->input->isInteractive()) { - $this->output->warning(trans('command/messages.key.warning')); - if (!$this->confirm(trans('command/messages.key.confirm'))) { + $this->output->warning('It appears you have already configured an application encryption key. Continuing with this process with overwrite that key and cause data corruption for any existing encrypted data. DO NOT CONTINUE UNLESS YOU KNOW WHAT YOU ARE DOING.'); + if (!$this->confirm('I understand the consequences of performing this command and accept all responsibility for the loss of encrypted data.')) { return; } - if (!$this->confirm(trans('command/messages.key.final_confirm'))) { + if (!$this->confirm('Are you sure you wish to continue? Changing the application encryption key WILL CAUSE DATA LOSS.')) { return; } } diff --git a/app/Console/Commands/Overrides/SeedCommand.php b/app/Console/Commands/Overrides/SeedCommand.php index 91b555d4b..4dbad13e7 100644 --- a/app/Console/Commands/Overrides/SeedCommand.php +++ b/app/Console/Commands/Overrides/SeedCommand.php @@ -10,12 +10,10 @@ class SeedCommand extends BaseSeedCommand use RequiresDatabaseMigrations; /** - * Block someone from running this seed command if they have not completed the migration - * process. - * - * @return int + * Block someone from running this seed command if they have not completed + * the migration process. */ - public function handle() + public function handle(): int { if (!$this->hasCompletedMigrations()) { return $this->showMigrationWarning(); diff --git a/app/Console/Commands/Overrides/UpCommand.php b/app/Console/Commands/Overrides/UpCommand.php index 3a5f34610..0be543198 100644 --- a/app/Console/Commands/Overrides/UpCommand.php +++ b/app/Console/Commands/Overrides/UpCommand.php @@ -10,9 +10,10 @@ class UpCommand extends BaseUpCommand use RequiresDatabaseMigrations; /** - * @return bool|int + * Block someone from running this up command if they have not completed + * the migration process. */ - public function handle() + public function handle(): int { if (!$this->hasCompletedMigrations()) { return $this->showMigrationWarning(); diff --git a/app/Console/Commands/Server/BulkReinstallActionCommand.php b/app/Console/Commands/Server/BulkReinstallActionCommand.php deleted file mode 100644 index e6250cc30..000000000 --- a/app/Console/Commands/Server/BulkReinstallActionCommand.php +++ /dev/null @@ -1,109 +0,0 @@ -. - * - * This software is licensed under the terms of the MIT license. - * https://opensource.org/licenses/MIT - */ - -namespace Pterodactyl\Console\Commands\Server; - -use Webmozart\Assert\Assert; -use Illuminate\Console\Command; -use GuzzleHttp\Exception\RequestException; -use Pterodactyl\Repositories\Eloquent\ServerRepository; -use Pterodactyl\Repositories\Wings\DaemonServerRepository; -use Pterodactyl\Services\Servers\ServerConfigurationStructureService; - -class BulkReinstallActionCommand extends Command -{ - /** - * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService - */ - private $configurationStructureService; - - /** - * @var \Pterodactyl\Repositories\Wings\DaemonServerRepository - */ - private $daemonRepository; - - /** - * @var \Pterodactyl\Repositories\Eloquent\ServerRepository - */ - private $repository; - - /** - * @var string - */ - protected $description = 'Reinstall a single server, all servers on a node, or all servers on the panel.'; - - /** - * @var string - */ - protected $signature = 'p:server:reinstall - {server? : The ID of the server to reinstall.} - {--node= : ID of the node to reinstall all servers on. Ignored if server is passed.}'; - - /** - * BulkReinstallActionCommand constructor. - */ - public function __construct( - DaemonServerRepository $daemonRepository, - ServerConfigurationStructureService $configurationStructureService, - ServerRepository $repository - ) { - parent::__construct(); - - $this->configurationStructureService = $configurationStructureService; - $this->daemonRepository = $daemonRepository; - $this->repository = $repository; - } - - /** - * Handle command execution. - */ - public function handle() - { - $servers = $this->getServersToProcess(); - - if (!$this->confirm(trans('command/messages.server.reinstall.confirm')) && $this->input->isInteractive()) { - return; - } - - $bar = $this->output->createProgressBar(count($servers)); - - $servers->each(function ($server) use ($bar) { - $bar->clear(); - - try { - $this->daemonRepository->setServer($server)->reinstall(); - } catch (RequestException $exception) { - $this->output->error(trans('command/messages.server.reinstall.failed', [ - 'name' => $server->name, - 'id' => $server->id, - 'node' => $server->node->name, - 'message' => $exception->getMessage(), - ])); - } - - $bar->advance(); - $bar->display(); - }); - - $this->line(''); - } - - /** - * Return the servers to be reinstalled. - * - * @return \Illuminate\Support\Collection - */ - private function getServersToProcess() - { - Assert::nullOrIntegerish($this->argument('server'), 'Value passed in server argument must be null or an integer, received %s.'); - Assert::nullOrIntegerish($this->option('node'), 'Value passed in node option must be null or integer, received %s.'); - - return $this->repository->getDataForReinstall($this->argument('server'), $this->option('node')); - } -} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index b5f8067ee..d5fa25ec4 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -23,12 +23,9 @@ class Kernel extends ConsoleKernel // Execute scheduled commands for servers every minute, as if there was a normal cron running. $schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping(); - // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted. - $pruneAge = config('backups.prune_age', 360); // Defaults to 6 hours (time is in minuteS) - if ($pruneAge > 0) { - $schedule->command('p:maintenance:prune-backups', [ - '--since-minutes' => $pruneAge, - ])->everyThirtyMinutes(); + if (config('backups.prune_age')) { + // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted. + $schedule->command('p:maintenance:prune-backups')->everyThirtyMinutes(); } // Every day cleanup any internal backups of service files. diff --git a/resources/lang/en/command/messages.php b/resources/lang/en/command/messages.php index 002c699bb..e135a1ec8 100644 --- a/resources/lang/en/command/messages.php +++ b/resources/lang/en/command/messages.php @@ -1,11 +1,6 @@ [ - 'warning' => 'It appears you have already configured an application encryption key. Continuing with this process with overwrite that key and cause data corruption for any existing encrypted data. DO NOT CONTINUE UNLESS YOU KNOW WHAT YOU ARE DOING.', - 'confirm' => 'I understand the consequences of performing this command and accept all responsibility for the loss of encrypted data.', - 'final_confirm' => 'Are you sure you wish to continue? Changing the application encryption key WILL CAUSE DATA LOSS.', - ], 'location' => [ 'no_location_found' => 'Could not locate a record matching the provided short code.', 'ask_short' => 'Location Short Code', From 6f3ea462a79597b4446ad79b727a6c65b1e2118d Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 15:52:57 -0800 Subject: [PATCH 2/7] Add command to execute all of the normal upgrade commands for the application --- .../Commands/Overrides/SeedCommand.php | 8 +- app/Console/Commands/Overrides/UpCommand.php | 8 +- app/Console/Commands/UpgradeCommand.php | 111 ++++++++++++++++++ app/Console/RequiresDatabaseMigrations.php | 4 +- 4 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 app/Console/Commands/UpgradeCommand.php diff --git a/app/Console/Commands/Overrides/SeedCommand.php b/app/Console/Commands/Overrides/SeedCommand.php index 4dbad13e7..5f050e340 100644 --- a/app/Console/Commands/Overrides/SeedCommand.php +++ b/app/Console/Commands/Overrides/SeedCommand.php @@ -13,12 +13,14 @@ class SeedCommand extends BaseSeedCommand * Block someone from running this seed command if they have not completed * the migration process. */ - public function handle(): int + public function handle() { if (!$this->hasCompletedMigrations()) { - return $this->showMigrationWarning(); + $this->showMigrationWarning(); + + return; } - return parent::handle(); + parent::handle(); } } diff --git a/app/Console/Commands/Overrides/UpCommand.php b/app/Console/Commands/Overrides/UpCommand.php index 0be543198..3001edcbe 100644 --- a/app/Console/Commands/Overrides/UpCommand.php +++ b/app/Console/Commands/Overrides/UpCommand.php @@ -13,12 +13,14 @@ class UpCommand extends BaseUpCommand * Block someone from running this up command if they have not completed * the migration process. */ - public function handle(): int + public function handle() { if (!$this->hasCompletedMigrations()) { - return $this->showMigrationWarning(); + $this->showMigrationWarning(); + + return; } - return parent::handle(); + parent::handle(); } } diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php new file mode 100644 index 000000000..9ca38515d --- /dev/null +++ b/app/Console/Commands/UpgradeCommand.php @@ -0,0 +1,111 @@ +input->isInteractive()) { + if (!$this->confirm('Are you sure you want to run the upgrade process for your Panel?')) { + return; + } + } + + ini_set('output_buffering', 0); + $bar = $this->output->createProgressBar(8); + $bar->start(); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan down'); + $this->call('down'); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> chmod -R 755 storage bootstrap/cache'); + $process = new Process(['chmod', '-R', '755', 'storage', 'bootstrap/cache']); + $process->run(function ($type, $buffer) { + $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); + }); + }); + + $this->withProgress($bar, function () { + $command = ['composer', 'install', '--no-ansi']; + if (config('app.env') === 'production' && !config('app.debug')) { + $command[] = '--optimize-autoloader'; + $command[] = '--no-dev'; + } + + $this->line('$upgrader> ' . implode(' ', $command)); + $process = new Process($command); + $process->run(function ($type, $buffer) { + $this->line($buffer); + }); + }); + + /** @var \Illuminate\Foundation\Application $app */ + $app = require __DIR__ . '/../../../bootstrap/app.php'; + /** @var \Pterodactyl\Console\Kernel $kernel */ + $kernel = $app->make(Kernel::class); + $kernel->bootstrap(); + $this->setLaravel($app); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan view:clear'); + $this->call('view:clear'); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan config:clear'); + $this->call('config:clear'); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan migrate --seed --force'); + $this->call('migrate', ['--seed' => '', '--force' => '']); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan queue:restart'); + $this->call('queue:restart'); + }); + + $this->withProgress($bar, function () { + $this->line('$upgrader> php artisan up'); + $this->call('up'); + }); + + $this->newLine(); + $this->info('Finished running upgrade.'); + } + + protected function withProgress(ProgressBar $bar, Closure $callback) + { + $bar->clear(); + $callback(); + $bar->advance(); + $bar->display(); + } +} diff --git a/app/Console/RequiresDatabaseMigrations.php b/app/Console/RequiresDatabaseMigrations.php index 479722b63..0a4ca4944 100644 --- a/app/Console/RequiresDatabaseMigrations.php +++ b/app/Console/RequiresDatabaseMigrations.php @@ -33,7 +33,7 @@ trait RequiresDatabaseMigrations * them to properly run the migrations rather than ignoring all of the other previous * errors... */ - protected function showMigrationWarning(): int + protected function showMigrationWarning() { $this->getOutput()->writeln(' | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | @@ -51,7 +51,5 @@ database state by running the command above. '); $this->getOutput()->error('You must correct the error above before continuing.'); - - return 1; } } From fb98b1892d668e1666c7eff9716a27b2fb964441 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 16:07:49 -0800 Subject: [PATCH 3/7] Add simple logic to download and unpack the archive --- app/Console/Commands/UpgradeCommand.php | 33 ++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index 9ca38515d..6da06038c 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -10,11 +10,13 @@ use Symfony\Component\Console\Helper\ProgressBar; class UpgradeCommand extends Command { - /** @var string */ - protected $signature = 'p:upgrade {--force}'; + protected const DEFAULT_URL = 'https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz'; /** @var string */ - protected $description = 'Executes the commands necessary for getting Pterodactyl operational after installing new files.'; + protected $signature = 'p:upgrade {--url=} {--skip-download}'; + + /** @var string */ + protected $description = 'Downloads a new archive for Pterodactyl from GitHub and then executes the normal upgrade commands.'; /** * Executes an upgrade command which will run through all of our standard @@ -28,16 +30,39 @@ class UpgradeCommand extends Command */ public function handle() { + $skipDownload = $this->option('skip-download'); + + if (!$skipDownload) { + $this->output->warning('This command does not verify the integrity of downloaded assets. Please ensure that you trust the download source before continuing. If you do not wish to download an archive, please indicate that using the --skip-download flag, or answering "no" to the question below.'); + $this->output->comment('Download Source (set with --url=):'); + $this->line($this->option('url') ?? self::DEFAULT_URL); + } + if ($this->input->isInteractive()) { + if (!$skipDownload) { + $skipDownload = !$this->confirm('Would you like to download and unpack the archive files for the latest version?', true); + } + if (!$this->confirm('Are you sure you want to run the upgrade process for your Panel?')) { return; } } ini_set('output_buffering', 0); - $bar = $this->output->createProgressBar(8); + $bar = $this->output->createProgressBar($skipDownload ? 8 : 9); $bar->start(); + if (!$skipDownload) { + $this->withProgress($bar, function () { + $url = $this->option('url') ?? self::DEFAULT_URL; + $this->line("\$upgrader> curl -L \"$url\" | tar -xzv"); + $process = Process::fromShellCommandline("curl -L \"$url\" | tar -xzvf"); + $process->run(function ($type, $buffer) { + $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); + }); + }); + } + $this->withProgress($bar, function () { $this->line('$upgrader> php artisan down'); $this->call('down'); From db5c9b3675911b99c37b6742592ced2df42a5ed7 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 16:12:13 -0800 Subject: [PATCH 4/7] Allow specification of a version --- app/Console/Commands/UpgradeCommand.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index 6da06038c..97fa37339 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -10,10 +10,13 @@ use Symfony\Component\Console\Helper\ProgressBar; class UpgradeCommand extends Command { - protected const DEFAULT_URL = 'https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz'; + protected const DEFAULT_URL = 'https://github.com/pterodactyl/panel/releases/%s/panel.tar.gz'; /** @var string */ - protected $signature = 'p:upgrade {--url=} {--skip-download}'; + protected $signature = 'p:upgrade + {--url= : The specific archive to download.} + {--release= : A specific Pterodactyl version to download from GitHub. Leave blank to use latest.} + {--skip-download : If set no archive will be downloaded.}'; /** @var string */ protected $description = 'Downloads a new archive for Pterodactyl from GitHub and then executes the normal upgrade commands.'; @@ -35,7 +38,7 @@ class UpgradeCommand extends Command if (!$skipDownload) { $this->output->warning('This command does not verify the integrity of downloaded assets. Please ensure that you trust the download source before continuing. If you do not wish to download an archive, please indicate that using the --skip-download flag, or answering "no" to the question below.'); $this->output->comment('Download Source (set with --url=):'); - $this->line($this->option('url') ?? self::DEFAULT_URL); + $this->line($this->getUrl()); } if ($this->input->isInteractive()) { @@ -54,9 +57,8 @@ class UpgradeCommand extends Command if (!$skipDownload) { $this->withProgress($bar, function () { - $url = $this->option('url') ?? self::DEFAULT_URL; - $this->line("\$upgrader> curl -L \"$url\" | tar -xzv"); - $process = Process::fromShellCommandline("curl -L \"$url\" | tar -xzvf"); + $this->line("\$upgrader> curl -L \"{$this->getUrl()}\" | tar -xzv"); + $process = Process::fromShellCommandline("curl -L \"{$this->getUrl()}\" | tar -xzvf"); $process->run(function ($type, $buffer) { $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); }); @@ -133,4 +135,13 @@ class UpgradeCommand extends Command $bar->advance(); $bar->display(); } + + protected function getUrl(): string + { + if ($this->option('url')) { + return $this->option('url'); + } + + return sprintf(self::DEFAULT_URL, $this->option('release') ? 'download/v' . $this->option('release') : 'latest/download'); + } } From fd9245b2c57438f709e2bc2a921a4516a5d7dd1a Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 16:27:23 -0800 Subject: [PATCH 5/7] Make sure we chown the files at the end of the process --- app/Console/Commands/UpgradeCommand.php | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index 97fa37339..25059ad88 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -14,6 +14,7 @@ class UpgradeCommand extends Command /** @var string */ protected $signature = 'p:upgrade + {--user= : The user that PHP runs under. All files will be owned by this user.} {--url= : The specific archive to download.} {--release= : A specific Pterodactyl version to download from GitHub. Leave blank to use latest.} {--skip-download : If set no archive will be downloaded.}'; @@ -41,18 +42,35 @@ class UpgradeCommand extends Command $this->line($this->getUrl()); } + $user = 'www-data'; if ($this->input->isInteractive()) { if (!$skipDownload) { $skipDownload = !$this->confirm('Would you like to download and unpack the archive files for the latest version?', true); } + if (is_null($this->option('user'))) { + $details = posix_getpwuid(fileowner('public')); + $user = $details['name'] ?? 'www-data'; + + if (!$this->confirm("Your webserver user has been detected as [{$user}]: is this correct?", true)) { + $user = $this->anticipate( + 'Please enter the name of the user running your webserver process. This varies from system to system, but is generally "www-data", "nginx", or "apache".', + [ + 'www-data', + 'apache', + 'nginx', + ] + ); + } + } + if (!$this->confirm('Are you sure you want to run the upgrade process for your Panel?')) { return; } } ini_set('output_buffering', 0); - $bar = $this->output->createProgressBar($skipDownload ? 8 : 9); + $bar = $this->output->createProgressBar($skipDownload ? 9 : 10); $bar->start(); if (!$skipDownload) { @@ -114,6 +132,14 @@ class UpgradeCommand extends Command $this->call('migrate', ['--seed' => '', '--force' => '']); }); + $this->withProgress($bar, function () use ($user) { + $this->line("\$upgrader> chown -R {$user}:{$user} *"); + $process = Process::fromShellCommandline("chown -R {$user}:{$user} *"); + $process->run(function ($type, $buffer) { + $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); + }); + }); + $this->withProgress($bar, function () { $this->line('$upgrader> php artisan queue:restart'); $this->call('queue:restart'); From 2a8d336336a6f133543defad0b2d50488d2dee8d Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 16:29:18 -0800 Subject: [PATCH 6/7] Ensure slow commands have time to run --- app/Console/Commands/UpgradeCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index 25059ad88..a5e461391 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -105,6 +105,7 @@ class UpgradeCommand extends Command $this->line('$upgrader> ' . implode(' ', $command)); $process = new Process($command); + $process->setTimeout(10 * 60); $process->run(function ($type, $buffer) { $this->line($buffer); }); @@ -134,7 +135,8 @@ class UpgradeCommand extends Command $this->withProgress($bar, function () use ($user) { $this->line("\$upgrader> chown -R {$user}:{$user} *"); - $process = Process::fromShellCommandline("chown -R {$user}:{$user} *"); + $process = Process::fromShellCommandline("chown -R {$user}:{$user} *", $this->getLaravel()->basePath()); + $process->setTimeout(10 * 60); $process->run(function ($type, $buffer) { $this->{$type === Process::ERR ? 'error' : 'line'}($buffer); }); From bf2291357f27404d33377b3ce0bdd59b5edf66ad Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 23 Jan 2021 16:32:43 -0800 Subject: [PATCH 7/7] Just stop people right there. --- app/Console/Commands/UpgradeCommand.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index a5e461391..d42964942 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -35,13 +35,16 @@ class UpgradeCommand extends Command public function handle() { $skipDownload = $this->option('skip-download'); - if (!$skipDownload) { $this->output->warning('This command does not verify the integrity of downloaded assets. Please ensure that you trust the download source before continuing. If you do not wish to download an archive, please indicate that using the --skip-download flag, or answering "no" to the question below.'); $this->output->comment('Download Source (set with --url=):'); $this->line($this->getUrl()); } + if (version_compare(PHP_VERSION, '7.4.0') < 0) { + $this->error('Cannot execute self-upgrade process. The minimum required PHP version required is 7.4.0, you have [' . PHP_VERSION . '].'); + } + $user = 'www-data'; if ($this->input->isInteractive()) { if (!$skipDownload) {