BUG Fix installer for 4.0 (#40)

This commit is contained in:
Damian Mooyman 2016-10-26 14:24:22 +13:00 committed by Sam Minnée
parent a34d67c753
commit 6a25ac4ab4
2 changed files with 11 additions and 5 deletions

View File

@ -7,8 +7,10 @@ use SilverStripe\MSSQL\MSSQLDatabaseConfigurationHelper;
/** @skipUpgrade */
DatabaseAdapterRegistry::register(array(
'class' => 'MSSQLPDODatabase',
'module' => 'mssql',
'title' => 'SQL Server 2008 (using PDO)',
'helperPath' => dirname(__FILE__).'/code/MSSQLDatabaseConfigurationHelper.php',
'helperPath' => __DIR__.'/code/MSSQLDatabaseConfigurationHelper.php',
'helperClass' => MSSQLDatabaseConfigurationHelper::class,
'supported' => !!MSSQLDatabaseConfigurationHelper::getPDODriver(),
'missingExtensionText' =>
'Either the <a href="http://www.php.net/manual/en/book.pdo.php">PDO Extension</a> or
@ -20,8 +22,10 @@ DatabaseAdapterRegistry::register(array(
/** @skipUpgrade */
DatabaseAdapterRegistry::register(array(
'class' => 'MSSQLDatabase',
'module' => 'mssql',
'title' => 'SQL Server 2008 (using sqlsrv)',
'helperPath' => dirname(__FILE__).'/code/MSSQLDatabaseConfigurationHelper.php',
'helperPath' => __DIR__.'/code/MSSQLDatabaseConfigurationHelper.php',
'helperClass' => MSSQLDatabaseConfigurationHelper::class,
'supported' => function_exists('sqlsrv_connect'),
'missingExtensionText' =>
'The <a href="http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx">sqlsrv</a>
@ -39,8 +43,10 @@ DatabaseAdapterRegistry::register(array(
/** @skipUpgrade */
DatabaseAdapterRegistry::register(array(
'class' => 'MSSQLAzureDatabase',
'module' => 'mssql',
'title' => 'MS Azure Database (using sqlsrv)',
'helperPath' => dirname(__FILE__).'/code/MSSQLDatabaseConfigurationHelper.php',
'helperPath' => __DIR__.'/code/MSSQLDatabaseConfigurationHelper.php',
'helperClass' => MSSQLDatabaseConfigurationHelper::class,
'supported' => function_exists('sqlsrv_connect'),
'missingExtensionText' =>
'The <a href="http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx">sqlsrv</a>

View File

@ -25,6 +25,7 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
/**
* Create a connection of the appropriate type
*
* @skipUpgrade
* @param array $databaseConfig
* @param string $error Error message passed by value
* @return mixed|null Either the connection object, or null if error
@ -32,7 +33,6 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
protected function createConnection($databaseConfig, &$error)
{
$error = null;
/** @skipUpgrade */
try {
switch ($databaseConfig['type']) {
case 'MSSQLDatabase':
@ -78,7 +78,7 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
return null;
}
default:
$error = 'Invalid connection type';
$error = 'Invalid connection type: ' . $databaseConfig['type'];
return null;
}
} catch (Exception $ex) {