MINOR dev/build now shows database name and version next to "Building database ..." text

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@111851 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-10-11 01:09:31 +00:00 committed by Sam Minnee
parent f0b68587bc
commit 5019881d1d

View File

@ -161,10 +161,13 @@ class DatabaseAdmin extends Controller {
DB::quiet(); DB::quiet();
} else { } else {
$conn = DB::getConn(); $conn = DB::getConn();
// Assumes database class is like "MySQLDatabase" or "MSSQLDatabase" (suffixed with "Database")
$dbType = substr(get_class($conn), 0, -8);
$dbVersion = $conn->getVersion();
$databaseName = (method_exists($conn, 'currentDatabase')) ? $conn->currentDatabase() : ""; $databaseName = (method_exists($conn, 'currentDatabase')) ? $conn->currentDatabase() : "";
if(Director::is_cli()) echo "\n\nBuilding Database $databaseName\n\n"; if(Director::is_cli()) echo sprintf("\n\nBuilding database %s using %s %s\n\n", $databaseName, $dbType, $dbVersion);
else echo "<h2>Building Database $databaseName</h2>"; else echo sprintf("<h2>Building database %s using %s %s</h2>", $databaseName, $dbType, $dbVersion);
} }
// Set up the initial database // Set up the initial database