Skip to content

Commit c56e699

Browse files
authored
Separated user from group
1 parent 2f6351e commit c56e699

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

app/Console/Commands/UpgradeCommand.php

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class UpgradeCommand extends Command
1414

1515
/** @var string */
1616
protected $signature = 'p:upgrade
17-
{--user= : The user (and group) that PHP runs under. All files will be owned by this user (and group).}
17+
{--user= : The user that PHP runs under. All files will be owned by this user.}
18+
{--group= : The group that PHP runs under. All files will be owned by this group.}
1819
{--url= : The specific archive to download.}
1920
{--release= : A specific Pterodactyl version to download from GitHub. Leave blank to use latest.}
2021
{--skip-download : If set no archive will be downloaded.}';
@@ -53,19 +54,32 @@ public function handle()
5354
}
5455

5556
if (is_null($this->option('user'))) {
56-
$user_details = posix_getpwuid(fileowner('public'));
57-
$user = $user_details['name'] ?? 'www-data';
58-
59-
$group_details = posix_getgrgid(filegroup('public'));
60-
$group = $group_details['name'] ?? 'www-data';
57+
$userDetails = posix_getpwuid(fileowner('public'));
58+
$user = $userDetails['name'] ?? 'www-data';
6159

62-
if (!$this->confirm("Your webserver user (and group) has been detected as [{$user}:{$group}]: is this correct?", true)) {
60+
if (!$this->confirm("Your webserver user has been detected as [{$user}]: is this correct?", true)) {
6361
$user = $this->anticipate(
64-
'Please enter the name of the user running your webserver process. This varies from system to system, but is generally "www-data:www-data", "nginx:nginx", or "apache:apache".',
62+
'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".',
6563
[
66-
'www-data:www-data',
67-
'nginx:nginx',
68-
'apache:apache',
64+
'www-data',
65+
'nginx',
66+
'apache',
67+
]
68+
);
69+
}
70+
}
71+
72+
if (is_null($this->option('group'))) {
73+
$groupDetails = posix_getgrgid(filegroup('public'));
74+
$group = $groupDetails['name'] ?? 'www-data';
75+
76+
if (!$this->confirm("Your webserver group has been detected as [{$group}]: is this correct?", true)) {
77+
$group = $this->anticipate(
78+
'Please enter the name of the group running your webserver process. Normally this is the same as your user.',
79+
[
80+
'www-data',
81+
'nginx',
82+
'apache',
6983
]
7084
);
7185
}

0 commit comments

Comments
 (0)