mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17509] Add installer DBMS version checks
PHPBB-17509
This commit is contained in:
parent
215d1bf1eb
commit
bf2c22354a
2 changed files with 43 additions and 28 deletions
|
@ -184,9 +184,9 @@ $lang = array_merge($lang, array(
|
|||
'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.',
|
||||
|
||||
// Database options
|
||||
'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC',
|
||||
'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]',
|
||||
'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension',
|
||||
'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server via ODBC',
|
||||
'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server [ Native ]',
|
||||
'DB_OPTION_MYSQLI' => 'MySQL',
|
||||
'DB_OPTION_ORACLE' => 'Oracle',
|
||||
'DB_OPTION_POSTGRES' => 'PostgreSQL',
|
||||
'DB_OPTION_SQLITE3' => 'SQLite 3',
|
||||
|
@ -202,7 +202,8 @@ $lang = array_merge($lang, array(
|
|||
'INST_ERR_DB_NO_WRITABLE' => 'Both the database and the directory containing it must be writable.',
|
||||
'INST_ERR_DB_NO_ERROR' => 'No error message given.',
|
||||
'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.',
|
||||
'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.',
|
||||
'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is too old, it must be upgraded to at least 5.6.',
|
||||
'INST_ERR_DB_NO_MSSQL' => 'The version of Microsoft SQL Server installed on this machine is too old, it must be upgraded to at least SQL Server 2012 (11.0.2100.60)',
|
||||
'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.8.3.',
|
||||
'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed is too old, it must be upgraded to at least 12.1.0.2.',
|
||||
'INST_ERR_DB_NO_POSTGRES' => 'The version of the PostgreSQL you have installed is too old, it must be upgraded to at least 9.4.',
|
||||
|
|
|
@ -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,19 @@ class database
|
|||
}
|
||||
|
||||
// Check if database version is supported
|
||||
$db_server_version = $doctrine_db->getWrappedConnection()->getServerVersion();
|
||||
switch ($dbms)
|
||||
{
|
||||
case 'mysqli':
|
||||
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.8.3', '<'))
|
||||
if (version_compare($db_server_version, '3.8.3', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_SQLITE3',
|
||||
|
@ -416,20 +425,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 +433,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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue