minor fixes in installation process

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-08-20 11:21:49 +02:00
parent 2c9b2c1d67
commit 07094f231a
3 changed files with 16 additions and 9 deletions

View File

@@ -57,13 +57,17 @@ final class InstallCommand extends Command
{
$result = self::SUCCESS;
if ($input->getOption('create-userdata-from-str') !== false) {
if ($input->getOption('create-userdata-from-str') !== null) {
$ud_str = $input->getOption('create-userdata-from-str');
$ud_dec = json_decode(base64_decode($ud_str), true);
$ud_dec = @json_decode(@base64_decode($ud_str), true);
if (is_array($ud_dec) && !empty($ud_dec) && count($ud_dec) == 8) {
$core = new Core($ud_dec);
$core->createUserdataConf();
return $result;
}
$output->writeln("<error>Invalid parameter value.</>");
return self::INVALID;
}
session_start();
@@ -130,6 +134,7 @@ final class InstallCommand extends Command
$this->io->info('Running unattended installation');
} else {
$extended = $this->io->confirm('Use advanced installation mode?', false);
$decoded_input = [];
}
$result = $this->showStep(0, $extended, $decoded_input);
@@ -246,7 +251,7 @@ final class InstallCommand extends Command
if ($step == 3) {
// do actual install with data from $this->formfielddata
$core = new Core($this->formfielddata);
$core->doInstall();
$core->doInstall(false);
$core->createUserdataConf();
}
return $this->showStep(++$step, $extended, $decoded_input);

View File

@@ -52,7 +52,7 @@ class Core
* @return void
* @throws Exception
*/
public function doInstall()
public function doInstall(bool $create_ud_str = true)
{
$options = [
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8'
@@ -116,8 +116,10 @@ class Core
$this->doDataEntries($pdo);
// create JSON array for config-services
$this->createJsonArray();
if ($create_ud_str) {
$this->createUserdataParamStr();
}
}
public function getUnprivilegedPdo(): PDO
{

View File

@@ -220,7 +220,7 @@ return [
'system' => [
'label' => lng('install.install.runcmd'),
'type' => 'textarea',
'value' => (!empty($_SESSION['installation']['ud_str']) ? Froxlor::getInstallDir() . "bin/froxlor-cli froxlor:install -c '" . $_SESSION['installation']['ud_str'] . "'" : "something went wrong...") . "\n" .
'value' => (!empty($_SESSION['installation']['ud_str']) ? Froxlor::getInstallDir() . "bin/froxlor-cli froxlor:install -c '" . $_SESSION['installation']['ud_str'] . "'\n" : "") .
(!empty($_SESSION['installation']['json_params']) ? Froxlor::getInstallDir() . "bin/froxlor-cli froxlor:config-services -a '" . $_SESSION['installation']['json_params'] . "' --yes-to-all" : "something went wrong..."),
'readonly' => true,
'rows' => 10,