mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
NEW: Deprecated PDO in favour of native drivers
https://github.com/silverstripe/silverstripe-framework/issues/8598
This commit is contained in:
parent
731646f49d
commit
27ace03273
@ -4,24 +4,6 @@
|
||||
use SilverStripe\Dev\Install\DatabaseAdapterRegistry;
|
||||
use SilverStripe\Dev\Install\MySQLDatabaseConfigurationHelper;
|
||||
|
||||
|
||||
// Register MySQL PDO as a database adapter (listed as first option in Dev/Install/config-form.html)
|
||||
DatabaseAdapterRegistry::register(
|
||||
array(
|
||||
/** @skipUpgrade */
|
||||
'class' => 'MySQLPDODatabase',
|
||||
'module' => 'framework',
|
||||
'title' => 'MySQL 5.0+ (using PDO)',
|
||||
'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php',
|
||||
'helperClass' => MySQLDatabaseConfigurationHelper::class,
|
||||
'supported' => (class_exists('PDO') && in_array('mysql', PDO::getAvailableDrivers())),
|
||||
'missingExtensionText' =>
|
||||
'Either the <a href="http://www.php.net/manual/en/book.pdo.php">PDO Extension</a> or
|
||||
the <a href="http://www.php.net/manual/en/ref.pdo-mysql.php">MySQL PDO Driver</a>
|
||||
are unavailable. Please install or enable these and refresh this page.'
|
||||
)
|
||||
);
|
||||
|
||||
// Register MySQLi as a database adapter (listed as second option in Dev/Install/config-form.html)
|
||||
DatabaseAdapterRegistry::register(
|
||||
array(
|
||||
@ -37,3 +19,20 @@ DatabaseAdapterRegistry::register(
|
||||
PHP extension is not available. Please install or enable it and refresh this page.'
|
||||
)
|
||||
);
|
||||
|
||||
// Register MySQL PDO as a database adapter (listed as first option in Dev/Install/config-form.html)
|
||||
DatabaseAdapterRegistry::register(
|
||||
array(
|
||||
/** @skipUpgrade */
|
||||
'class' => 'MySQLPDODatabase',
|
||||
'module' => 'framework',
|
||||
'title' => 'MySQL 5.0+ (using PDO) - <b>not recommended</b>',
|
||||
'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php',
|
||||
'helperClass' => MySQLDatabaseConfigurationHelper::class,
|
||||
'supported' => (class_exists('PDO') && in_array('mysql', PDO::getAvailableDrivers())),
|
||||
'missingExtensionText' =>
|
||||
'Either the <a href="http://www.php.net/manual/en/book.pdo.php">PDO Extension</a> or
|
||||
the <a href="http://www.php.net/manual/en/ref.pdo-mysql.php">MySQL PDO Driver</a>
|
||||
are unavailable. Please install or enable these and refresh this page.'
|
||||
)
|
||||
);
|
||||
|
@ -20,8 +20,8 @@ class InstallConfig
|
||||
* @var array
|
||||
*/
|
||||
protected $preferredDatabases = [
|
||||
'MySQLPDODatabase',
|
||||
'MySQLDatabase',
|
||||
'MySQLPDODatabase',
|
||||
];
|
||||
|
||||
public function __construct($basePath = null)
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace SilverStripe\ORM\Connect;
|
||||
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use PDO;
|
||||
use PDOStatement;
|
||||
use InvalidArgumentException;
|
||||
@ -135,6 +136,9 @@ class PDOConnector extends DBConnector implements TransactionManager
|
||||
|
||||
public function connect($parameters, $selectDB = false)
|
||||
{
|
||||
Deprecation::notice('4.5', 'Use native database drivers in favour of PDO. '
|
||||
. 'https://github.com/silverstripe/silverstripe-framework/issues/8598');
|
||||
|
||||
$this->flushStatements();
|
||||
|
||||
// Note that we don't select the database here until explicitly
|
||||
|
Loading…
Reference in New Issue
Block a user