From eeeed9890e953c504339ee9b754129684d675e32 Mon Sep 17 00:00:00 2001 From: sminnee Date: Thu, 17 Jan 2008 01:58:10 +0000 Subject: [PATCH] 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 --- install.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/install.php b/install.php index 27e9bb0..35a861e 100644 --- a/install.php +++ b/install.php @@ -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 "

The following problems are preventing me from installing SilverStripe CMS:

"; + echo "

The following problems are preventing me from installing SilverStripe CMS:

\n\n"; foreach($this->errors as $error) { - echo "
  • " . htmlentities($error) . "
  • "; + echo "
  • " . htmlentities(implode(", ", $error)) . "
  • \n"; } } }