Skip to content

Commit

Permalink
Merge pull request #11354 from creative-commoners/pulls/6/mysql5
Browse files Browse the repository at this point in the history
DEP Remove support for MySQL 5
  • Loading branch information
GuySartorelli authored Aug 28, 2024
2 parents ea93316 + cd4efcf commit e969786
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion _register_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[
'class' => 'MySQLDatabase',
'module' => 'framework',
'title' => 'MySQL 5.0+ (using MySQLi)',
'title' => 'MySQL 8.0+ (using MySQLi)',
'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php',
'helperClass' => MySQLDatabaseConfigurationHelper::class,
'supported' => class_exists('MySQLi'),
Expand Down
6 changes: 3 additions & 3 deletions src/Dev/Install/MySQLDatabaseConfigurationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function requireDatabaseVersion($databaseConfig)
if ($version) {
$success = version_compare($version ?? '', '5.0', '>=');
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 {
$error = "Could not determine your MySQL version.";
Expand Down Expand Up @@ -178,7 +178,7 @@ public function checkValidDatabaseName($database)
}

// 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 ?? '');
}

Expand All @@ -199,7 +199,7 @@ public function checkDatabasePermissionGrant($database, $permission, $grant)
}

// 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(
'((%s)|(%s)|(%s)|(%s))',
preg_quote("\"$sqlDatabase\".*"), // Regexp escape sql-escaped db identifier
Expand Down
4 changes: 1 addition & 3 deletions src/ORM/Connect/DBSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ protected function determineIndexType($spec)
* 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.
*
* @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
*
* @param string|array $indexSpec
Expand Down Expand Up @@ -679,8 +679,6 @@ public function requireField($table, $field, $spec)
$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()) {
$spec = preg_replace('/ *character set [^ ]+( collate [^ ]+)?( |$)/', '\\2', $spec ?? '');
}
Expand Down
5 changes: 2 additions & 3 deletions src/ORM/Connect/MySQLDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,8 @@ public function getLock($name, $timeout = 5)
{
$id = $this->getLockIdentifier($name);

// MySQL 5.7.4 and below auto-releases existing locks on subsequent GET_LOCK() calls.
// MySQL 5.7.5 and newer allow multiple locks per sessions even with the same name.
// https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock
// MySQL 8.0.0 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
return (bool) $this->query(sprintf("SELECT GET_LOCK('%s', %d)", $id, $timeout))->value();
}

Expand Down
2 changes: 1 addition & 1 deletion src/ORM/FieldType/DBField.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* <b>Subclass Example</b>
*
* 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>
* class Blob extends DBField {
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Queries/SQLDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SQLDelete extends SQLConditionalExpression
* List of tables to limit the delete to, if multiple tables
* 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
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/php/ORM/SQLSelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ public function testBaseTableAliases()
public function provideWith()
{
// 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 [
// Just a CTE, no union
'basic CTE with aliased columns' => [
Expand Down

0 comments on commit e969786

Please sign in to comment.