Merge pull request #4 from tractorcow/pulls/deprecate-memory

BUG Properly deprecate old 'memory' config setting
This commit is contained in:
Simon Welsh 2014-03-06 10:50:50 +13:00
commit 400920f8de
3 changed files with 22 additions and 0 deletions

View File

@ -1,5 +1,7 @@
<?php
Deprecation::notification_version('1.3.0', 'sqlite3');
$classes = array('SQLiteDatabase', 'SQLite3Database', 'SQLitePDODatabase');
global $databaseConfig;

View File

@ -63,6 +63,16 @@ class SQLite3Database extends SS_Database {
function connectDatabase() {
$this->enum_map = array();
$parameters = $this->parameters;
if(!empty($parameters['memory'])) {
Deprecation::notice(
'1.4.0',
"\$databaseConfig['memory'] is deprecated. Use \$databaseConfig['path'] = ':memory:' instead.",
Deprecation::SCOPE_GLOBAL
);
$parameters['path'] = ':memory:';
}
$dbName = !isset($this->database) ? $parameters['database'] : $this->database;
$file = $parameters['path'];

View File

@ -13,6 +13,16 @@ class SQLitePDODatabase extends SQLite3Database {
function connectDatabase() {
$this->enum_map = array();
$parameters = $this->parameters;
if(!empty($parameters['memory'])) {
Deprecation::notice(
'1.4.0',
"\$databaseConfig['memory'] is deprecated. Use \$databaseConfig['path'] = ':memory:' instead.",
Deprecation::SCOPE_GLOBAL
);
$parameters['path'] = ':memory:';
}
$dbName = !isset($this->database) ? $parameters['database'] : $dbName=$this->database;
$file = $parameters['path'];