ENHANCEMENT: Improved layout of altercation message when called via CLI. Patch via simon_w #4373 (from r94515)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@95618 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-12-16 05:42:21 +00:00
parent f663e4f949
commit d1e5f7dc91

View File

@ -614,30 +614,50 @@ abstract class SS_Database {
*/ */
function alterationMessage($message,$type=""){ function alterationMessage($message,$type=""){
if(!$this->supressOutput) { if(!$this->supressOutput) {
$color = ""; if(Director::is_cli()) {
switch ($type){ switch ($type){
case "created": case "created":
$color = "green"; case "changed":
break; case "repaired":
case "obsolete": $sign = "+";
$color = "red"; break;
break; case "obsolete":
case "error": case "deleted":
$color = "red"; $sign = '-';
break; break;
case "deleted": case "error":
$color = "red"; $sign = "!";
break; break;
case "changed": default:
$color = "blue"; $sign=" ";
break; }
case "repaired": $message = strip_tags($message);
$color = "blue"; echo " $sign $message\n";
break; } else {
default: switch ($type){
$color=""; case "created":
$color = "green";
break;
case "obsolete":
$color = "red";
break;
case "error":
$color = "red";
break;
case "deleted":
$color = "red";
break;
case "changed":
$color = "blue";
break;
case "repaired":
$color = "blue";
break;
default:
$color="";
}
echo "<li style=\"color: $color\">$message</li>";
} }
echo (Director::is_cli()) ? " * ".strip_tags($message)."\n" : "<li style=\"color: $color\">$message</li>";
} }
} }