fixes to install (mostly CLI)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -57,6 +57,8 @@ final class InstallCommand extends Command
|
|||||||
return self::INVALID;
|
return self::INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
require __DIR__ . '/install.functions.php';
|
require __DIR__ . '/install.functions.php';
|
||||||
|
|
||||||
$this->io = new SymfonyStyle($input, $output);
|
$this->io = new SymfonyStyle($input, $output);
|
||||||
@@ -133,6 +135,12 @@ final class InstallCommand extends Command
|
|||||||
$this->io->note($section['description']);
|
$this->io->note($section['description']);
|
||||||
foreach ($section['fields'] as $fieldname => $fielddata) {
|
foreach ($section['fields'] as $fieldname => $fielddata) {
|
||||||
if ($extended == false && isset($fielddata['advanced']) && $fielddata['advanced'] == true) {
|
if ($extended == false && isset($fielddata['advanced']) && $fielddata['advanced'] == true) {
|
||||||
|
if ($fieldname == 'httpuser' || $fieldname == 'httpgroup') {
|
||||||
|
// overwrite posix_getgrgid(posix_getgid())['name'] as it would result in 'root'
|
||||||
|
$this->formfielddata[$fieldname] = 'www-data';
|
||||||
|
} else {
|
||||||
|
$this->formfielddata[$fieldname] = $fielddata['value'];
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$fielddata['value'] = $this->formfielddata[$fieldname] ?? ($fielddata['value'] ?? null);
|
$fielddata['value'] = $this->formfielddata[$fieldname] ?? ($fielddata['value'] ?? null);
|
||||||
@@ -160,23 +168,24 @@ final class InstallCommand extends Command
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($step == 1) {
|
if ($step == 1) {
|
||||||
// $inst->checkDatabase($this->formfielddata);
|
$inst->checkDatabase($this->formfielddata);
|
||||||
} elseif ($step == 2) {
|
} elseif ($step == 2) {
|
||||||
// $inst->checkAdminUser($this->formfielddata);
|
$inst->checkAdminUser($this->formfielddata);
|
||||||
} elseif ($step == 3) {
|
} elseif ($step == 3) {
|
||||||
// $inst->checkSystem($this->formfielddata);
|
$inst->checkSystem($this->formfielddata);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
$this->io->error($e->getMessage());
|
$this->io->error($e->getMessage());
|
||||||
return $this->showStep($step, $extended);
|
return $this->showStep($step, $extended);
|
||||||
}
|
}
|
||||||
|
if ($step == 3) {
|
||||||
|
// do actual install with data from $this->formfielddata
|
||||||
|
$core = new Core($this->formfielddata);
|
||||||
|
$core->doInstall();
|
||||||
|
}
|
||||||
return $this->showStep(++$step, $extended);
|
return $this->showStep(++$step, $extended);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// do actual install with data from $this->formfielddata
|
|
||||||
// $core = new Core($this->formfielddata);
|
|
||||||
// $core->doInstall();
|
|
||||||
$section = $inst->formfield['install']['sections']['step' . $step] ?? [];
|
$section = $inst->formfield['install']['sections']['step' . $step] ?? [];
|
||||||
$this->io->section($section['title']);
|
$this->io->section($section['title']);
|
||||||
$this->io->note($section['description']);
|
$this->io->note($section['description']);
|
||||||
|
|||||||
@@ -298,9 +298,9 @@ class Install
|
|||||||
|
|
||||||
if (empty($serveripv4) && empty($serveripv6)) {
|
if (empty($serveripv4) && empty($serveripv6)) {
|
||||||
throw new Exception(lng('install.errors.nov4andnov6ip'));
|
throw new Exception(lng('install.errors.nov4andnov6ip'));
|
||||||
} elseif (!Validate::validate_ip2($serveripv4, true, '', false, true) || IPTools::is_ipv6($serveripv4)) {
|
} elseif (!empty($serveripv4) && (!Validate::validate_ip2($serveripv4, true, '', false, true) || IPTools::is_ipv6($serveripv4))) {
|
||||||
throw new Exception(lng('error.invalidip', [$serveripv4]));
|
throw new Exception(lng('error.invalidip', [$serveripv4]));
|
||||||
} elseif (!Validate::validate_ip2($serveripv6, true, '', false, true) || IPTools::is_ipv6($serveripv6) == false) {
|
} elseif (!empty($serveripv6) && (!Validate::validate_ip2($serveripv6, true, '', false, true) || IPTools::is_ipv6($serveripv6) == false)) {
|
||||||
throw new Exception(lng('error.invalidip', [$serveripv6]));
|
throw new Exception(lng('error.invalidip', [$serveripv6]));
|
||||||
} elseif (!Validate::validateDomain($servername) && !Validate::validateLocalHostname($servername)) {
|
} elseif (!Validate::validateDomain($servername) && !Validate::validateLocalHostname($servername)) {
|
||||||
throw new Exception(lng('install.errors.servernameneedstobevalid'));
|
throw new Exception(lng('install.errors.servernameneedstobevalid'));
|
||||||
|
|||||||
@@ -497,6 +497,7 @@ class Core
|
|||||||
`ssl` = :ssl
|
`ssl` = :ssl
|
||||||
");
|
");
|
||||||
$nvh = $this->validatedData['webserver'] == 'apache2' ? '1' : '0';
|
$nvh = $this->validatedData['webserver'] == 'apache2' ? '1' : '0';
|
||||||
|
$defaultip = false;
|
||||||
if (!empty($this->validatedData['serveripv6'])) {
|
if (!empty($this->validatedData['serveripv6'])) {
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
'nvh' => $nvh,
|
'nvh' => $nvh,
|
||||||
|
|||||||
Reference in New Issue
Block a user