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 */ /** @skipUpgrade */
DatabaseAdapterRegistry::register(array( DatabaseAdapterRegistry::register(array(
'class' => 'MSSQLPDODatabase', 'class' => 'MSSQLPDODatabase',
'module' => 'mssql',
'title' => 'SQL Server 2008 (using PDO)', 'title' => 'SQL Server 2008 (using PDO)',
'helperPath' => dirname(__FILE__).'/code/MSSQLDatabaseConfigurationHelper.php', 'helperPath' => __DIR__.'/code/MSSQLDatabaseConfigurationHelper.php',
'helperClass' => MSSQLDatabaseConfigurationHelper::class,
'supported' => !!MSSQLDatabaseConfigurationHelper::getPDODriver(), 'supported' => !!MSSQLDatabaseConfigurationHelper::getPDODriver(),
'missingExtensionText' => 'missingExtensionText' =>
'Either the <a href="http://www.php.net/manual/en/book.pdo.php">PDO Extension</a> or '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 */ /** @skipUpgrade */
DatabaseAdapterRegistry::register(array( DatabaseAdapterRegistry::register(array(
'class' => 'MSSQLDatabase', 'class' => 'MSSQLDatabase',
'module' => 'mssql',
'title' => 'SQL Server 2008 (using sqlsrv)', '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'), 'supported' => function_exists('sqlsrv_connect'),
'missingExtensionText' => 'missingExtensionText' =>
'The <a href="http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx">sqlsrv</a> 'The <a href="http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx">sqlsrv</a>
@ -39,8 +43,10 @@ DatabaseAdapterRegistry::register(array(
/** @skipUpgrade */ /** @skipUpgrade */
DatabaseAdapterRegistry::register(array( DatabaseAdapterRegistry::register(array(
'class' => 'MSSQLAzureDatabase', 'class' => 'MSSQLAzureDatabase',
'module' => 'mssql',
'title' => 'MS Azure Database (using sqlsrv)', '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'), 'supported' => function_exists('sqlsrv_connect'),
'missingExtensionText' => 'missingExtensionText' =>
'The <a href="http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx">sqlsrv</a> '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 * Create a connection of the appropriate type
* *
* @skipUpgrade
* @param array $databaseConfig * @param array $databaseConfig
* @param string $error Error message passed by value * @param string $error Error message passed by value
* @return mixed|null Either the connection object, or null if error * @return mixed|null Either the connection object, or null if error
@ -32,7 +33,6 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
protected function createConnection($databaseConfig, &$error) protected function createConnection($databaseConfig, &$error)
{ {
$error = null; $error = null;
/** @skipUpgrade */
try { try {
switch ($databaseConfig['type']) { switch ($databaseConfig['type']) {
case 'MSSQLDatabase': case 'MSSQLDatabase':
@ -78,7 +78,7 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
return null; return null;
} }
default: default:
$error = 'Invalid connection type'; $error = 'Invalid connection type: ' . $databaseConfig['type'];
return null; return null;
} }
} catch (Exception $ex) { } catch (Exception $ex) {