nicer CLI install

This commit is contained in:
Shish 2024-01-15 21:45:55 +00:00
parent 4c8029fce6
commit c0bb34fbf1

View file

@ -41,7 +41,11 @@ function install()
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();
}
}
}
@ -308,11 +312,16 @@ function write_config($dsn)
}
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(