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) { if ($dsn) {
do_install($dsn); do_install($dsn);
} else { } 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)) { if (file_put_contents("data/config/shimmie.conf.php", $file_content, LOCK_EX)) {
header("Location: index.php?flash=Installation%20complete"); if(PHP_SAPI == 'cli') {
die_nicely( print("Installation Successful\n");
"Installation Successful", exit(0);
"<p>If you aren't redirected, <a href=\"index.php\">click here to Continue</a>." } 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 { } else {
$h_file_content = htmlentities($file_content); $h_file_content = htmlentities($file_content);
throw new InstallerException( throw new InstallerException(