From 43f99930df2937644e311ec6b8da84cc622fd52e Mon Sep 17 00:00:00 2001 From: wrossiter Date: Fri, 19 Mar 2010 03:55:02 +0000 Subject: [PATCH] ENHANCEMENT: refactored requirements section to hide successful tests git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@101382 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- install.php | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/install.php b/install.php index 283a891..74541e2 100644 --- a/install.php +++ b/install.php @@ -442,12 +442,42 @@ class InstallRequirements { } else { foreach($this->tests as $section => $tests) { - echo "
$section
"; - echo ""; + $failedRequirements = 0; + $warningRequirements = 0; + + $output = ""; foreach($tests as $test => $result) { - echo ""; + if(isset($result['0'])) { + switch($result['0']) { + case 'error': + $failedRequirements++; + break; + case 'warning': + $warningRequirements++; + break; + } + } + $output .= ""; } + $className = "good"; + $text = "All Requirements Pass"; + $pluralWarnings = ($warningRequirements == 1) ? 'Warning' : 'Warnings'; + + if($failedRequirements > 0) { + $className = "error"; + $pluralWarnings = ($warningRequirements == 1) ? 'Warning' : 'Warnings'; + + $text = $failedRequirements . ' Failed and '. $warningRequirements . ' '. $pluralWarnings; + } + else if($warningRequirements > 0) { + $className = "warning"; + $text = "All Requirements Pass but ". $warningRequirements . ' '. $pluralWarnings; + } + + echo "
$section See All Requirements $text
"; + echo "
$test" . nl2br(htmlentities($result[1])) . "
$test" . nl2br(htmlentities($result[1])) . "
"; + echo $output; echo "
"; } } @@ -903,8 +933,6 @@ PHP } else { $this->statusMessage("Setting up 'mysite/_config.php'..."); - - $devServers = $this->var_export_array_nokeys(explode("\n", $_POST['devsites'])); $escapedPassword = addslashes($dbConfig['password']); $this->writeToFile("mysite/_config.php", <<