MINOR Amendments to installer database configuration and small issue detecting database support in PHP

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@98794 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sharvey 2010-02-11 09:32:26 +00:00 committed by Sam Minnee
parent 26bcd5a826
commit 0d54c89476

View File

@ -53,31 +53,35 @@ if($envFileExists) {
// This is a listing of known external databases // This is a listing of known external databases
$otherDatabaseLocations = array( $otherDatabaseLocations = array(
'mssql' => array( 'mssql' => array(
'dir' => 'mssql/code',
'class' => 'MSSQLDatabase', 'class' => 'MSSQLDatabase',
'title' => 'SQL Server 2008' 'title' => 'SQL Server 2008'
), ),
'postgresql' => array( 'postgresql' => array(
'dir' => 'postgresql/code',
'class' => 'PostgreSQLDatabase', 'class' => 'PostgreSQLDatabase',
'title' => 'PostgreSQL' 'title' => 'PostgreSQL'
), ),
'sqlite3' => array( 'sqlite3' => array(
'dir' => 'sqlite3/code',
'class' => 'SQLite3Database', 'class' => 'SQLite3Database',
'title' => 'SQLite 3' 'title' => 'SQLite 3'
), ),
'sqlitepdo' => array( 'sqlitepdo' => array(
'dir' => 'sqlite3/code',
'class' => 'SQLitePDODatabase', 'class' => 'SQLitePDODatabase',
'title' => 'SQLite PDO' 'title' => 'SQLite PDO'
) )
); );
// MySQL support comes out of the box with sapphire. Other databases // MySQL support comes out of the box with sapphire
// live in their own module directories. Let's find out if there
// are any installed and determine if they have a configuration helper.
$foundDatabaseClasses = array('MySQLDatabase' => 'MySQL'); $foundDatabaseClasses = array('MySQLDatabase' => 'MySQL');
include_once('sapphire/dev/install/DatabaseConfigurationHelper.php'); include_once('sapphire/dev/install/DatabaseConfigurationHelper.php');
include_once('sapphire/dev/install/MySQLDatabaseConfigurationHelper.php'); include_once('sapphire/dev/install/MySQLDatabaseConfigurationHelper.php');
foreach($otherDatabaseLocations as $dir => $details) {
$helperPath = $dir . '/code/' . $details['class'] . 'ConfigurationHelper.php'; // Determine which external database modules are installed
foreach($otherDatabaseLocations as $details) {
$helperPath = $details['dir'] . '/' . $details['class'] . 'ConfigurationHelper.php';
if(file_exists($helperPath)) { if(file_exists($helperPath)) {
$foundDatabaseClasses[$details['class']] = $details['title']; $foundDatabaseClasses[$details['class']] = $details['title'];
include_once($helperPath); include_once($helperPath);
@ -616,6 +620,7 @@ class InstallRequirements {
if($result) { if($result) {
return true; return true;
} else { } else {
$this->error($testDetails);
return false; return false;
} }
} }
@ -625,7 +630,6 @@ class InstallRequirements {
$helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']); $helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']);
$result = $helper->requireDatabaseConnection($databaseConfig); $result = $helper->requireDatabaseConnection($databaseConfig);
if($result['okay']) { if($result['okay']) {
$result['connection'];
return true; return true;
} else { } else {
$testDetails[2] .= ": " . $result['error']; $testDetails[2] .= ": " . $result['error'];