avoid using posix-extension function before requirement-check can test for it and inform user

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-03-15 08:54:50 +01:00
parent e9051dc30a
commit ae6ee95973
2 changed files with 10 additions and 3 deletions

View File

@@ -331,7 +331,7 @@ class PhpHelper
* @return string * @return string
*/ */
public static function sizeReadable( public static function sizeReadable(
int $size, $size,
?string $max = '', ?string $max = '',
string $system = 'si', string $system = 'si',
string $retstring = '%01.2f %s' string $retstring = '%01.2f %s'

View File

@@ -25,6 +25,13 @@
use Froxlor\Froxlor; use Froxlor\Froxlor;
$httpuser = '';
$httpgroup = '';
if (extension_loaded('posix')) {
$httpuser = posix_getpwuid(posix_getuid())['name'] ?? '';
$httpgroup = posix_getgrgid(posix_getgid())['name'] ?? '';
}
return [ return [
'install' => [ 'install' => [
'title' => 'install', 'title' => 'install',
@@ -194,7 +201,7 @@ return [
'placeholder' => lng('admin.webserver_user'), 'placeholder' => lng('admin.webserver_user'),
'type' => 'text', 'type' => 'text',
'mandatory' => true, 'mandatory' => true,
'value' => old('httpuser', posix_getpwuid(posix_getuid())['name'] ?? '', 'installation'), 'value' => old('httpuser', $httpuser, 'installation'),
'advanced' => true, 'advanced' => true,
], ],
'httpgroup' => [ 'httpgroup' => [
@@ -202,7 +209,7 @@ return [
'placeholder' => lng('admin.webserver_group'), 'placeholder' => lng('admin.webserver_group'),
'type' => 'text', 'type' => 'text',
'mandatory' => true, 'mandatory' => true,
'value' => old('httpgroup', posix_getgrgid(posix_getgid())['name'] ?? '', 'installation'), 'value' => old('httpgroup', $httpgroup, 'installation'),
'advanced' => true, 'advanced' => true,
], ],
'activate_newsfeed' => [ 'activate_newsfeed' => [