mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 17:12:30 +01:00
Make sure we chown the files at the end of the process
This commit is contained in:
parent
db5c9b3675
commit
fd9245b2c5
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user