mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
DEP Remove support for MySQL 5
This commit is contained in:
parent
ea93316d9c
commit
cd4efcf95f
@ -9,7 +9,7 @@ DatabaseAdapterRegistry::register(
|
|||||||
[
|
[
|
||||||
'class' => 'MySQLDatabase',
|
'class' => 'MySQLDatabase',
|
||||||
'module' => 'framework',
|
'module' => 'framework',
|
||||||
'title' => 'MySQL 5.0+ (using MySQLi)',
|
'title' => 'MySQL 8.0+ (using MySQLi)',
|
||||||
'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php',
|
'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php',
|
||||||
'helperClass' => MySQLDatabaseConfigurationHelper::class,
|
'helperClass' => MySQLDatabaseConfigurationHelper::class,
|
||||||
'supported' => class_exists('MySQLi'),
|
'supported' => class_exists('MySQLi'),
|
||||||
|
@ -135,7 +135,7 @@ class MySQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
|||||||
if ($version) {
|
if ($version) {
|
||||||
$success = version_compare($version ?? '', '5.0', '>=');
|
$success = version_compare($version ?? '', '5.0', '>=');
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
$error = "Your MySQL server version is $version. It's recommended you use at least MySQL 5.0.";
|
$error = "Your MySQL server version is $version. It's recommended you use at least MySQL 8.0.";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error = "Could not determine your MySQL version.";
|
$error = "Could not determine your MySQL version.";
|
||||||
@ -178,7 +178,7 @@ class MySQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restricted to characters in the ASCII and Extended ASCII range
|
// Restricted to characters in the ASCII and Extended ASCII range
|
||||||
// @see http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
|
// @see https://dev.mysql.com/doc/refman/8.4/en/identifiers.html
|
||||||
return preg_match('/^[\x{0001}-\x{FFFF}]+$/u', $database ?? '');
|
return preg_match('/^[\x{0001}-\x{FFFF}]+$/u', $database ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ class MySQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Escape all valid database patterns (permission must exist on all tables)
|
// Escape all valid database patterns (permission must exist on all tables)
|
||||||
$sqlDatabase = addcslashes($database ?? '', '_%'); // See http://dev.mysql.com/doc/refman/5.7/en/string-literals.html
|
$sqlDatabase = addcslashes($database ?? '', '_%'); // https://dev.mysql.com/doc/refman/8.4/en/string-literals.html
|
||||||
$dbPattern = sprintf(
|
$dbPattern = sprintf(
|
||||||
'((%s)|(%s)|(%s)|(%s))',
|
'((%s)|(%s)|(%s)|(%s))',
|
||||||
preg_quote("\"$sqlDatabase\".*"), // Regexp escape sql-escaped db identifier
|
preg_quote("\"$sqlDatabase\".*"), // Regexp escape sql-escaped db identifier
|
||||||
|
@ -601,7 +601,7 @@ abstract class DBSchemaManager
|
|||||||
* Some indexes may be arrays, such as fulltext and unique indexes, and this allows database-specific
|
* Some indexes may be arrays, such as fulltext and unique indexes, and this allows database-specific
|
||||||
* arrays to be created. See {@link requireTable()} for details on the index format.
|
* arrays to be created. See {@link requireTable()} for details on the index format.
|
||||||
*
|
*
|
||||||
* @see http://dev.mysql.com/doc/refman/5.0/en/create-index.html
|
* @see https://dev.mysql.com/doc/refman/8.4/en/create-index.html
|
||||||
* @see parseIndexSpec() for approximate inverse
|
* @see parseIndexSpec() for approximate inverse
|
||||||
*
|
*
|
||||||
* @param string|array $indexSpec
|
* @param string|array $indexSpec
|
||||||
@ -679,8 +679,6 @@ abstract class DBSchemaManager
|
|||||||
$spec = $this->{$spec['type']}($spec['parts'], true);
|
$spec = $this->{$spec['type']}($spec['parts'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collations didn't come in until MySQL 4.1. Anything earlier will throw a syntax error if you try and use
|
|
||||||
// collations.
|
|
||||||
if (!$this->database->supportsCollations()) {
|
if (!$this->database->supportsCollations()) {
|
||||||
$spec = preg_replace('/ *character set [^ ]+( collate [^ ]+)?( |$)/', '\\2', $spec ?? '');
|
$spec = preg_replace('/ *character set [^ ]+( collate [^ ]+)?( |$)/', '\\2', $spec ?? '');
|
||||||
}
|
}
|
||||||
|
@ -529,9 +529,8 @@ class MySQLDatabase extends Database implements TransactionManager
|
|||||||
{
|
{
|
||||||
$id = $this->getLockIdentifier($name);
|
$id = $this->getLockIdentifier($name);
|
||||||
|
|
||||||
// MySQL 5.7.4 and below auto-releases existing locks on subsequent GET_LOCK() calls.
|
// MySQL 8.0.0 and newer allow multiple locks per sessions even with the same name.
|
||||||
// MySQL 5.7.5 and newer allow multiple locks per sessions even with the same name.
|
// https://dev.mysql.com/doc/refman/8.4/en/locking-functions.html#function_get-lock
|
||||||
// https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock
|
|
||||||
return (bool) $this->query(sprintf("SELECT GET_LOCK('%s', %d)", $id, $timeout))->value();
|
return (bool) $this->query(sprintf("SELECT GET_LOCK('%s', %d)", $id, $timeout))->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ use SilverStripe\View\ViewableData;
|
|||||||
* <b>Subclass Example</b>
|
* <b>Subclass Example</b>
|
||||||
*
|
*
|
||||||
* The class is easy to overload with custom types, e.g. the MySQL "BLOB" type
|
* The class is easy to overload with custom types, e.g. the MySQL "BLOB" type
|
||||||
* (http://dev.mysql.com/doc/refman/5.0/en/blob.html).
|
* (https://dev.mysql.com/doc/refman/8.4/en/blob.html).
|
||||||
*
|
*
|
||||||
* <code>
|
* <code>
|
||||||
* class Blob extends DBField {
|
* class Blob extends DBField {
|
||||||
|
@ -15,7 +15,7 @@ class SQLDelete extends SQLConditionalExpression
|
|||||||
* List of tables to limit the delete to, if multiple tables
|
* List of tables to limit the delete to, if multiple tables
|
||||||
* are specified in the condition clause
|
* are specified in the condition clause
|
||||||
*
|
*
|
||||||
* @see http://dev.mysql.com/doc/refman/5.0/en/delete.html
|
* @see https://dev.mysql.com/doc/refman/8.4/en/delete.html
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
@ -957,7 +957,7 @@ class SQLSelectTest extends SapphireTest
|
|||||||
public function provideWith()
|
public function provideWith()
|
||||||
{
|
{
|
||||||
// Each of these examples shows it working with aliased implicit columns, and with explicit CTE columns.
|
// Each of these examples shows it working with aliased implicit columns, and with explicit CTE columns.
|
||||||
// Most of these examples are derived from https://dev.mysql.com/doc/refman/8.0/en/with.html
|
// Most of these examples are derived from https://dev.mysql.com/doc/refman/8.4/en/with.html
|
||||||
return [
|
return [
|
||||||
// Just a CTE, no union
|
// Just a CTE, no union
|
||||||
'basic CTE with aliased columns' => [
|
'basic CTE with aliased columns' => [
|
||||||
|
Loading…
Reference in New Issue
Block a user