2013-04-03 06:49:59 +02:00
|
|
|
<?php
|
|
|
|
|
2016-08-29 05:56:13 +02:00
|
|
|
use SilverStripe\Dev\Install\DatabaseAdapterRegistry;
|
2016-10-26 03:24:31 +02:00
|
|
|
use SilverStripe\SQLite\SQLiteDatabaseConfigurationHelper;
|
2016-08-29 05:56:13 +02:00
|
|
|
|
2013-04-03 06:49:59 +02:00
|
|
|
$sqliteDatabaseAdapterRegistryFields = array(
|
2017-11-21 05:35:20 +01:00
|
|
|
'path' => array(
|
|
|
|
'title' => 'Directory path<br /><small>Absolute path to directory, writeable by the webserver user.<br />'
|
|
|
|
. 'Recommended to be outside of your webroot</small>',
|
|
|
|
'default' => dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . '.sqlitedb'
|
|
|
|
),
|
|
|
|
'database' => array(
|
|
|
|
'title' => 'Database filename (extension .sqlite)',
|
|
|
|
'default' => 'database.sqlite'
|
|
|
|
)
|
2013-04-03 06:49:59 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// Basic SQLLite3 Database
|
2016-07-05 06:27:01 +02:00
|
|
|
/** @skipUpgrade */
|
2013-04-03 06:49:59 +02:00
|
|
|
DatabaseAdapterRegistry::register(
|
2017-11-21 05:35:20 +01:00
|
|
|
array(
|
|
|
|
'class' => 'SQLite3Database',
|
2016-10-26 03:24:31 +02:00
|
|
|
'module' => 'sqlite3',
|
2017-11-21 05:35:20 +01:00
|
|
|
'title' => 'SQLite 3.3+ (using SQLite3)',
|
|
|
|
'helperPath' => __DIR__.'/code/SQLiteDatabaseConfigurationHelper.php',
|
2016-10-26 03:24:31 +02:00
|
|
|
'helperClass' => SQLiteDatabaseConfigurationHelper::class,
|
2017-11-21 05:35:20 +01:00
|
|
|
'supported' => class_exists('SQLite3'),
|
|
|
|
'missingExtensionText' => 'The <a href="http://php.net/manual/en/book.sqlite3.php">SQLite3</a>
|
2013-04-03 06:49:59 +02:00
|
|
|
PHP Extension is not available. Please install or enable it of them and refresh this page.',
|
2017-11-21 05:35:20 +01:00
|
|
|
'fields' => array_merge($sqliteDatabaseAdapterRegistryFields, array('key' => array(
|
|
|
|
'title' => 'Encryption key<br><small>This function is experimental and requires configuration of an '
|
|
|
|
. 'encryption module</small>',
|
|
|
|
'default' => ''
|
|
|
|
)))
|
|
|
|
)
|
2013-04-03 06:49:59 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// PDO database
|
2016-07-05 06:27:01 +02:00
|
|
|
/** @skipUpgrade */
|
2013-04-03 06:49:59 +02:00
|
|
|
DatabaseAdapterRegistry::register(
|
2017-11-21 05:35:20 +01:00
|
|
|
array(
|
|
|
|
'class' => 'SQLite3PDODatabase',
|
2016-10-26 03:24:31 +02:00
|
|
|
'module' => 'sqlite3',
|
2017-11-21 05:35:20 +01:00
|
|
|
'title' => 'SQLite 3.3+ (using PDO)',
|
|
|
|
'helperPath' => __DIR__.'/code/SQLiteDatabaseConfigurationHelper.php',
|
2016-10-26 03:24:31 +02:00
|
|
|
'helperClass' => SQLiteDatabaseConfigurationHelper::class,
|
2017-11-21 05:35:20 +01:00
|
|
|
'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
|
2013-04-03 06:49:59 +02:00
|
|
|
<a href="http://php.net/manual/en/book.sqlite3.php">SQLite3 PDO Driver</a>
|
|
|
|
are unavailable. Please install or enable these and refresh this page.',
|
2017-11-21 05:35:20 +01:00
|
|
|
'fields' => $sqliteDatabaseAdapterRegistryFields
|
|
|
|
)
|
2013-04-03 06:49:59 +02:00
|
|
|
);
|