Better error for cli-install errors, uses exit(1) to stop make

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@48145 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sminnee 2008-01-17 01:58:10 +00:00
parent 5ed785dc71
commit eeeed9890e

View File

@ -71,6 +71,15 @@ if($databaseConfig) {
// Actual processor
$installFromCli = (isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'install');
// CLI-install error message. exit(1) will halt any makefile.
if($installFromCli && ($req->hasErrors() || $dbReq->hasErrors())) {
echo "Cannot install due to errors:\n";
$req->listErrors();
$dbReq->listErrors();
exit(1);
}
if(isset($_REQUEST['go']) || $installFromCli && !$req->hasErrors() && !$dbReq->hasErrors()) {
// Confirm before reinstalling
if(!isset($_REQUEST['force_reinstall']) && !$installFromCli && $alreadyInstalled) {
@ -237,9 +246,9 @@ class InstallRequirements {
function listErrors() {
if($this->errors) {
echo "<p>The following problems are preventing me from installing SilverStripe CMS:</p>";
echo "<p>The following problems are preventing me from installing SilverStripe CMS:</p>\n\n";
foreach($this->errors as $error) {
echo "<li>" . htmlentities($error) . "</li>";
echo "<li>" . htmlentities(implode(", ", $error)) . "</li>\n";
}
}
}