mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-10 10:44:20 +02:00
Merge pull request #6821 from rxu/ticket/17509
[ticket/17509] Bump DBMS supported versions
This commit is contained in:
@@ -79,7 +79,7 @@ class connection_parameter_factory
|
||||
string|null $name = null,
|
||||
string|null $port = null) : array
|
||||
{
|
||||
if ($params['driver'] === 'pdo_sqlite')
|
||||
if (in_array($params['driver'], ['pdo_sqlite', 'sqlite3']))
|
||||
{
|
||||
return self::enrich_parameters(
|
||||
self::build_sqlite_parameters($params, $host, $user, $password)
|
||||
|
@@ -15,7 +15,7 @@ namespace phpbb\db\driver;
|
||||
|
||||
/**
|
||||
* SQLite3 Database Abstraction Layer
|
||||
* Minimum Requirement: 3.6.15+
|
||||
* Minimum Requirement: 3.8.3+
|
||||
*/
|
||||
class sqlite3 extends \phpbb\db\driver\driver
|
||||
{
|
||||
|
@@ -289,6 +289,12 @@ class doctrine implements tools_interface
|
||||
|
||||
if (count($primary_key_indexes))
|
||||
{
|
||||
// For PostgreSQL, drop primary index first to avoid "Dependent objects still exist" error
|
||||
if (stripos($this->get_schema_manager()->getDatabasePlatform()->getname(), 'postgresql') !== false)
|
||||
{
|
||||
$this->get_schema_manager()->dropIndex('"primary"', $table_name);
|
||||
}
|
||||
|
||||
$ret = $this->alter_schema(
|
||||
function (Schema $schema) use ($table_name, $column_name): void
|
||||
{
|
||||
@@ -478,7 +484,7 @@ class doctrine implements tools_interface
|
||||
catch (Exception $e)
|
||||
{
|
||||
// @todo: check if it makes sense to properly handle the exception
|
||||
return false;
|
||||
return [$e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class database
|
||||
// Note: php 5.5 alpha 2 deprecated mysql.
|
||||
// Keep mysqli before mysql in this list.
|
||||
'mysqli' => array(
|
||||
'LABEL' => 'MySQL with MySQLi Extension',
|
||||
'LABEL' => 'MySQL',
|
||||
'SCHEMA' => 'mysql_41',
|
||||
'MODULE' => 'mysqli',
|
||||
'DOCTRINE' => ['pdo_mysql'],
|
||||
@@ -59,7 +59,7 @@ class database
|
||||
'2.0.x' => true,
|
||||
),
|
||||
'mssqlnative' => array(
|
||||
'LABEL' => 'MS SQL Server 2005+ [ Native ]',
|
||||
'LABEL' => 'MS SQL Server [ Native ]',
|
||||
'SCHEMA' => 'mssql',
|
||||
'MODULE' => 'sqlsrv',
|
||||
'DOCTRINE' => ['pdo_sqlsrv'],
|
||||
@@ -78,7 +78,7 @@ class database
|
||||
'2.0.x' => false,
|
||||
),
|
||||
'postgres' => array(
|
||||
'LABEL' => 'PostgreSQL 8.3+',
|
||||
'LABEL' => 'PostgreSQL',
|
||||
'SCHEMA' => 'postgres',
|
||||
'MODULE' => 'pgsql',
|
||||
'DOCTRINE' => ['pdo_pgsql'],
|
||||
@@ -405,10 +405,29 @@ class database
|
||||
}
|
||||
|
||||
// Check if database version is supported
|
||||
/** @psalm-suppress UndefinedInterfaceMethod */
|
||||
$db_server_version = $doctrine_db->getWrappedConnection()->getServerVersion();
|
||||
switch ($dbms)
|
||||
{
|
||||
case 'mysqli':
|
||||
if (stripos($db->sql_server_info(), 'mariadb') !== false && version_compare($db_server_version, '10.2.7', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_MARIADB',
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (version_compare($db_server_version, '5.6', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_MYSQLI',
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'sqlite3':
|
||||
if (version_compare($db->sql_server_info(true), '3.6.15', '<'))
|
||||
if (version_compare($db_server_version, '3.8.3', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_SQLITE3',
|
||||
@@ -416,20 +435,7 @@ class database
|
||||
}
|
||||
break;
|
||||
case 'oracle':
|
||||
$sql = "SELECT *
|
||||
FROM NLS_DATABASE_PARAMETERS
|
||||
WHERE PARAMETER = 'NLS_RDBMS_VERSION'
|
||||
OR PARAMETER = 'NLS_CHARACTERSET'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$stats = [];
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$stats[$row['parameter']] = $row['value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8')
|
||||
if (version_compare($db_server_version, '12.1.0.2', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_ORACLE',
|
||||
@@ -437,17 +443,35 @@ class database
|
||||
}
|
||||
break;
|
||||
case 'postgres':
|
||||
$sql = "SHOW server_encoding;";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
|
||||
if (version_compare($db_server_version, '9.4', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_POSTGRES',
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SHOW server_encoding;";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_POSTGRES_UTF8',
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'mssqlnative':
|
||||
case 'mssql_odbc':
|
||||
if (version_compare($db_server_version, '11.0.2100.60', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_MSSQL',
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user