nicer CLI install

This commit is contained in:
Shish 2024-01-15 21:48:14 +00:00
parent b9d98b6861
commit 031ccce961

View file

@ -46,7 +46,11 @@ function install(): void
if ($dsn) {
do_install($dsn);
} else {
ask_questions();
if(PHP_SAPI == 'cli') {
print("INSTALL_DSN needs to be set for CLI installation\n");
} else {
ask_questions();
}
}
}
@ -310,11 +314,16 @@ function write_config(string $dsn): void
}
if (file_put_contents("data/config/shimmie.conf.php", $file_content, LOCK_EX)) {
header("Location: index.php?flash=Installation%20complete");
die_nicely(
"Installation Successful",
"<p>If you aren't redirected, <a href=\"index.php\">click here to Continue</a>."
);
if(PHP_SAPI == 'cli') {
print("Installation Successful\n");
exit(0);
} else {
header("Location: index.php?flash=Installation%20complete");
die_nicely(
"Installation Successful",
"<p>If you aren't redirected, <a href=\"index.php\">click here to Continue</a>."
);
}
} else {
$h_file_content = htmlentities($file_content);
throw new InstallerException(