mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 15:05:37 +00:00
BUG Fix installer for 4.0 (#29)
This commit is contained in:
parent
cfdf20b253
commit
7304708fa1
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\Install\DatabaseAdapterRegistry;
|
||||
use SilverStripe\SQLite\SQLiteDatabaseConfigurationHelper;
|
||||
|
||||
$sqliteDatabaseAdapterRegistryFields = array(
|
||||
'path' => array(
|
||||
@ -19,8 +20,10 @@ $sqliteDatabaseAdapterRegistryFields = array(
|
||||
DatabaseAdapterRegistry::register(
|
||||
array(
|
||||
'class' => 'SQLite3Database',
|
||||
'module' => 'sqlite3',
|
||||
'title' => 'SQLite 3.3+ (using SQLite3)',
|
||||
'helperPath' => dirname(__FILE__).'/code/SQLiteDatabaseConfigurationHelper.php',
|
||||
'helperPath' => __DIR__.'/code/SQLiteDatabaseConfigurationHelper.php',
|
||||
'helperClass' => SQLiteDatabaseConfigurationHelper::class,
|
||||
'supported' => class_exists('SQLite3'),
|
||||
'missingExtensionText' => 'The <a href="http://php.net/manual/en/book.sqlite3.php">SQLite3</a>
|
||||
PHP Extension is not available. Please install or enable it of them and refresh this page.',
|
||||
@ -37,8 +40,10 @@ DatabaseAdapterRegistry::register(
|
||||
DatabaseAdapterRegistry::register(
|
||||
array(
|
||||
'class' => 'SQLite3PDODatabase',
|
||||
'module' => 'sqlite3',
|
||||
'title' => 'SQLite 3.3+ (using PDO)',
|
||||
'helperPath' => dirname(__FILE__).'/code/SQLiteDatabaseConfigurationHelper.php',
|
||||
'helperPath' => __DIR__.'/code/SQLiteDatabaseConfigurationHelper.php',
|
||||
'helperClass' => SQLiteDatabaseConfigurationHelper::class,
|
||||
'supported' => (class_exists('PDO') && in_array('sqlite', PDO::getAvailableDrivers())),
|
||||
'missingExtensionText' =>
|
||||
'Either the <a href="http://php.net/manual/en/book.pdo.php">PDO Extension</a> or the
|
||||
|
@ -20,6 +20,7 @@ class SQLiteDatabaseConfigurationHelper 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
|
||||
@ -27,7 +28,6 @@ class SQLiteDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
||||
protected function createConnection($databaseConfig, &$error)
|
||||
{
|
||||
$error = null;
|
||||
/** @skipUpgrade */
|
||||
try {
|
||||
if (!file_exists($databaseConfig['path'])) {
|
||||
self::create_db_dir($databaseConfig['path']);
|
||||
@ -49,7 +49,7 @@ class SQLiteDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
||||
$conn = @new PDO("sqlite:$file");
|
||||
break;
|
||||
default:
|
||||
$error = 'Invalid connection type';
|
||||
$error = 'Invalid connection type: ' . $databaseConfig['type'];
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user