aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2019-10-06 12:07:35 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-10-06 12:07:35 +0200
commitbd02c5bd085e957aa4341e7fc2df2199081ab069 (patch)
treeea737eab62dc1f56bb3760542b0f27095f6eca64
parent68c197fd6012b5435a29a288113b957e7957de59 (diff)
downloadforums-bd02c5bd085e957aa4341e7fc2df2199081ab069.tar
forums-bd02c5bd085e957aa4341e7fc2df2199081ab069.tar.gz
forums-bd02c5bd085e957aa4341e7fc2df2199081ab069.tar.bz2
forums-bd02c5bd085e957aa4341e7fc2df2199081ab069.tar.xz
forums-bd02c5bd085e957aa4341e7fc2df2199081ab069.zip
[ticket/16051] Remove mysql driver as it's no longer supported in PHP >= 7.0
PHPBB3-16051
-rw-r--r--phpBB/develop/add_permissions.php9
-rw-r--r--phpBB/develop/create_schema_files.php1
-rw-r--r--phpBB/develop/mysql_upgrader.php212
-rw-r--r--phpBB/docs/coding-guidelines.html2
-rw-r--r--phpBB/includes/acp/acp_database.php2
-rw-r--r--phpBB/includes/acp/acp_forums.php1
-rw-r--r--phpBB/includes/acp/acp_reasons.php2
-rw-r--r--phpBB/includes/functions_admin.php6
-rw-r--r--phpBB/includes/functions_convert.php5
-rw-r--r--phpBB/install/convert/convertor.php16
-rw-r--r--phpBB/install/convertors/functions_phpbb20.php22
-rw-r--r--phpBB/language/en/install.php1
-rw-r--r--phpBB/phpbb/db/driver/mysql.php502
-rw-r--r--phpBB/phpbb/db/extractor/mysql_extractor.php104
-rw-r--r--phpBB/phpbb/db/tools/tools.php85
-rw-r--r--phpBB/phpbb/install/helper/database.php18
-rw-r--r--phpBB/phpbb/install/module/install_database/task/create_schema.php9
-rw-r--r--phpBB/phpbb/install/module/install_database/task/set_up_database.php9
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php21
-rw-r--r--phpBB/phpbb/search/fulltext_native.php2
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php4
-rw-r--r--tests/RUNNING_TESTS.md1
-rw-r--r--tests/di/fixtures/config.php2
-rw-r--r--tests/functions/convert_30_dbms_to_31_test.php1
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php16
-rwxr-xr-xtravis/setup-database.sh2
26 files changed, 20 insertions, 1035 deletions
diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php
index d7308a1acc..d2c8bffd90 100644
--- a/phpBB/develop/add_permissions.php
+++ b/phpBB/develop/add_permissions.php
@@ -210,7 +210,7 @@ foreach ($prefixes as $prefix)
);
$db->sql_query('INSERT INTO ' . ACL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
-
+
echo "<p><b>Adding $auth_option...</b></p>\n";
mass_auth('group', 0, 'guests', $auth_option, ACL_NEVER);
@@ -231,7 +231,7 @@ $db->sql_query($sql);
$cache->destroy('_acl_options');
echo "<p><b>Done</b></p>\n";
-
+
/*
$ug_type = user|group
$forum_id = forum ids (array|int|0) -> 0 == all forums
@@ -374,11 +374,6 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
case 'insert':
switch ($db->get_sql_layer())
{
- case 'mysql':
- case 'mysql4':
- $sql = 'VALUES ' . implode(', ', preg_replace('#^(.*?)$#', '(\1)', $sql_subary));
- break;
-
case 'sqlite3':
$sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary));
break;
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 6e0a082045..fdaa285f99 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -21,7 +21,6 @@
$schema_path = dirname(__FILE__) . '/../install/schemas/';
$supported_dbms = array(
'mssql',
- 'mysql_40',
'mysql_41',
'oracle',
'postgres',
diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php
deleted file mode 100644
index 276c010e84..0000000000
--- a/phpBB/develop/mysql_upgrader.php
+++ /dev/null
@@ -1,212 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
-
-/**
-* This file creates SQL statements to upgrade phpBB on MySQL 3.x/4.0.x to 4.1.x/5.x
-*/
-
-//
-// Security message:
-//
-// This script is potentially dangerous.
-// Remove or comment the next line (die(".... ) to enable this script.
-// Do NOT FORGET to either remove this script or disable it after you have used it.
-//
-die("Please read the first lines of this script for instructions on how to enable it");
-
-define('IN_PHPBB', true);
-$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
-$phpEx = substr(strrchr(__FILE__, '.'), 1);
-include($phpbb_root_path . 'common.' . $phpEx);
-
-$prefix = $table_prefix;
-
-$newline = "\n";
-
-if (PHP_SAPI !== 'cli')
-{
- $newline = '<br>';
-}
-
-$sql = 'DESCRIBE ' . POSTS_TABLE . ' post_text';
-$result = $db->sql_query($sql);
-
-$row = $db->sql_fetchrow($result);
-
-$db->sql_freeresult($result);
-
-$mysql_indexer = $drop_index = false;
-
-if (strtolower($row['Type']) === 'mediumtext')
-{
- $mysql_indexer = true;
-}
-
-if (strtolower($row['Key']) === 'mul')
-{
- $drop_index = true;
-}
-
-echo "USE $dbname;$newline$newline";
-
-
-@set_time_limit(0);
-
-$finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path);
-$classes = $finder->core_path('phpbb/')
- ->directory('/db/migration/data')
- ->get_classes();
-
-$factory = new \phpbb\db\tools\factory();
-$db_tools = $factory->get($db, true);
-
-$schema_generator = new \phpbb\db\migration\schema_generator($classes, $config, $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
-$schema_data = $schema_generator->get_schema();
-$dbms_type_map = \phpbb\db\tools\tools::get_dbms_type_map();
-
-foreach ($schema_data as $table_name => $table_data)
-{
- $table_name = str_replace('phpbb_', $prefix, $table_name);
- // Write comment about table
- echo "# Table: '{$table_name}'$newline";
-
- // Create Table statement
- $generator = $textimage = false;
-
- // Do we need to DROP a fulltext index before we alter the table?
- if ($table_name == ($prefix . 'posts') && $drop_index)
- {
- echo "ALTER TABLE {$table_name}{$newline}";
- echo "DROP INDEX post_text,{$newline}DROP INDEX post_subject,{$newline}DROP INDEX post_content;{$newline}{$newline}";
- }
-
- $line = "ALTER TABLE {$table_name} $newline";
-
- // Table specific so we don't get overlap
- $modded_array = array();
-
- // Write columns one by one...
- foreach ($table_data['COLUMNS'] as $column_name => $column_data)
- {
- // Get type
- if (strpos($column_data[0], ':') !== false)
- {
- list($orig_column_type, $column_length) = explode(':', $column_data[0]);
- $column_type = sprintf($dbms_type_map['mysql_41'][$orig_column_type . ':'], $column_length);
-
- if (isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit']) &&
- isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0]))
- {
- switch ($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0])
- {
- case 'mult':
- if (($column_length * $dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][1]) > $dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][2])
- {
- $modded_array[$column_name] = $column_type;
- }
- break;
- }
- }
-
- $orig_column_type .= ':';
- }
- else
- {
- $orig_column_type = $column_data[0];
- $other_column_type = $dbms_type_map['mysql_40'][$column_data[0]];
- if ($other_column_type == 'text' || $other_column_type == 'blob')
- {
- $modded_array[$column_name] = $column_type;
- }
- $column_type = $dbms_type_map['mysql_41'][$column_data[0]];
- }
-
- // Adjust default value if db-dependent specified
- if (is_array($column_data[1]))
- {
- $column_data[1] = (isset($column_data[1][$dbms])) ? $column_data[1][$dbms] : $column_data[1]['default'];
- }
-
- $line .= "\tMODIFY {$column_name} {$column_type} ";
-
- // For hexadecimal values do not use single quotes
- if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob')
- {
- $line .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' ";
- }
- $line .= 'NOT NULL';
-
- if (isset($column_data[2]))
- {
- if ($column_data[2] == 'auto_increment')
- {
- $line .= ' auto_increment';
- }
- else if ($column_data[2] == 'true_sort')
- {
- $line .= ' COLLATE utf8_unicode_ci';
- }
- else if ($column_data[2] == 'no_sort')
- {
- $line .= ' COLLATE utf8_bin';
- }
- }
- else if (preg_match('/(?:var)?char|(?:medium)?text/i', $column_type))
- {
- $line .= ' COLLATE utf8_bin';
- }
-
- $line .= ",$newline";
- }
-
- // Write Keys
- if (isset($table_data['KEYS']))
- {
- foreach ($table_data['KEYS'] as $key_name => $key_data)
- {
- $temp = '';
- if (!is_array($key_data[1]))
- {
- $key_data[1] = array($key_data[1]);
- }
-
- $temp .= ($key_data[0] == 'INDEX') ? "\tADD KEY" : '';
- $temp .= ($key_data[0] == 'UNIQUE') ? "\tADD UNIQUE" : '';
- $repair = false;
- foreach ($key_data[1] as $key => $col_name)
- {
- if (isset($modded_array[$col_name]))
- {
- $repair = true;
- }
- }
- if ($repair)
- {
- $line .= "\tDROP INDEX " . $key_name . ",$newline";
- $line .= $temp;
- $line .= ' ' . $key_name . ' (' . implode(', ', $key_data[1]) . "),$newline";
- }
- }
- }
-
- //$line .= "\tCONVERT TO CHARACTER SET `utf8`$newline";
- $line .= "\tDEFAULT CHARSET=utf8 COLLATE=utf8_bin;$newline$newline";
-
- echo $line . "$newline";
-
- // Do we now need to re-add the fulltext index? ;)
- if ($table_name == ($prefix . 'posts') && $drop_index)
- {
- echo "ALTER TABLE $table_name ADD FULLTEXT (post_subject), ADD FULLTEXT (post_text), ADD FULLTEXT post_content (post_subject, post_text);{$newline}";
- }
-}
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index 72ad115e71..6cf647c55f 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -738,7 +738,7 @@ static private function f()</pre>
<a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3>
<h4>Common SQL Guidelines: </h4>
- <p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), SQLite, Oracle8, ODBC (generalised if possible)).</p>
+ <p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), SQLite, Oracle8, ODBC (generalised if possible)).</p>
<p>All SQL commands should utilise the DataBase Abstraction Layer (DBAL)</p>
<h4>SQL code layout:</h4>
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 677fce7217..c1c748832b 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -248,8 +248,6 @@ class acp_database
switch ($db->get_sql_layer())
{
- case 'mysql':
- case 'mysql4':
case 'mysqli':
case 'sqlite3':
while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false)
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index cb0593b14a..9044cd0e97 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -1878,7 +1878,6 @@ class acp_forums
switch ($db->get_sql_layer())
{
- case 'mysql4':
case 'mysqli':
// Delete everything else and thank MySQL for offering multi-table deletion
diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php
index dfb2ccbfd3..f3f82bdfca 100644
--- a/phpBB/includes/acp/acp_reasons.php
+++ b/phpBB/includes/acp/acp_reasons.php
@@ -222,8 +222,6 @@ class acp_reasons
{
// The ugly one!
case 'mysqli':
- case 'mysql4':
- case 'mysql':
// Change the reports using this reason to 'other'
$sql = 'UPDATE ' . REPORTS_TABLE . '
SET reason_id = ' . $other_reason_id . ", report_text = CONCAT('" . $db->sql_escape($reason_row['reason_description']) . "\n\n', report_text)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index ce5f0812aa..4629706048 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1384,7 +1384,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$db->sql_transaction('begin');
switch ($db->get_sql_layer())
{
- case 'mysql4':
case 'mysqli':
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
USING ' . TOPICS_TABLE . ' t1, ' . TOPICS_TABLE . " t2
@@ -2683,8 +2682,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false)
switch ($db->get_sql_layer())
{
case 'mysqli':
- case 'mysql4':
- $sql = 'DELETE ' . (($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '4.1', '>=')) ? 'z.*' : ZEBRA_TABLE) . '
+ $sql = 'DELETE z.*
FROM ' . ZEBRA_TABLE . ' z, ' . USER_GROUP_TABLE . ' ug
WHERE z.zebra_id = ug.user_id
AND z.foe = 1
@@ -2840,8 +2838,6 @@ function get_database_size()
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
switch ($db->get_sql_layer())
{
- case 'mysql':
- case 'mysql4':
case 'mysqli':
$sql = 'SELECT VERSION() AS mysql_version';
$result = $db->sql_query($sql);
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 2cfbe9541d..13e01afe51 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1647,11 +1647,6 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO)
case 'insert':
switch ($db->get_sql_layer())
{
- case 'mysql':
- case 'mysql4':
- $sql = 'VALUES ' . implode(', ', preg_replace('#^(.*?)$#', '(\1)', $sql_subary));
- break;
-
case 'sqlite3':
case 'mssqlnative':
$sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary));
diff --git a/phpBB/install/convert/convertor.php b/phpBB/install/convert/convertor.php
index e79ad64012..09088fe824 100644
--- a/phpBB/install/convert/convertor.php
+++ b/phpBB/install/convert/convertor.php
@@ -148,16 +148,6 @@ class convertor
$convert->src_truncate_statement = 'DELETE FROM ';
break;
- // Thanks MySQL, for silently converting...
- case 'mysql':
- case 'mysql4':
- if (version_compare($src_db->sql_server_info(true, false), '4.1.3', '>='))
- {
- $convert->mysql_convert = true;
- }
- $convert->src_truncate_statement = 'TRUNCATE TABLE ';
- break;
-
case 'mysqli':
$convert->mysql_convert = true;
$convert->src_truncate_statement = 'TRUNCATE TABLE ';
@@ -748,8 +738,6 @@ class convertor
switch ($db->get_sql_layer())
{
// If MySQL, we'll wait to have num_wait_rows rows to submit at once
- case 'mysql':
- case 'mysql4':
case 'mysqli':
$waiting_rows[] = '(' . implode(', ', $insert_values) . ')';
@@ -1258,9 +1246,7 @@ class convertor
global $db, $user;
global $convert;
- // Can we use IGNORE with this DBMS?
- $sql_ignore = (strpos($db->get_sql_layer(), 'mysql') === 0 && !defined('DEBUG')) ? 'IGNORE ' : '';
- $insert_query = 'INSERT ' . $sql_ignore . 'INTO ' . $schema['target'] . ' (';
+ $insert_query = 'INSERT INTO ' . $schema['target'] . ' (';
$aliases = array();
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 69dc7bb4bc..b89c086533 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -1754,21 +1754,6 @@ function phpbb_create_userconv_table()
switch ($db->get_sql_layer())
{
- case 'mysql':
- $map_dbms = 'mysql_40';
- break;
-
- case 'mysql4':
- if (version_compare($db->sql_server_info(true), '4.1.3', '>='))
- {
- $map_dbms = 'mysql_41';
- }
- else
- {
- $map_dbms = 'mysql_40';
- }
- break;
-
case 'mysqli':
$map_dbms = 'mysql_41';
break;
@@ -1794,13 +1779,6 @@ function phpbb_create_userconv_table()
)';
break;
- case 'mysql_40':
- $create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' (
- user_id mediumint(8) NOT NULL,
- username_clean blob NOT NULL
- )';
- break;
-
case 'mysql_41':
$create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' (
user_id mediumint(8) NOT NULL,
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 2fd2cfd89f..53d9940560 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -186,7 +186,6 @@ $lang = array_merge($lang, array(
// Database options
'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC',
'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]',
- 'DB_OPTION_MYSQL' => 'MySQL',
'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension',
'DB_OPTION_ORACLE' => 'Oracle',
'DB_OPTION_POSTGRES' => 'PostgreSQL',
diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php
deleted file mode 100644
index 8ce70444c2..0000000000
--- a/phpBB/phpbb/db/driver/mysql.php
+++ /dev/null
@@ -1,502 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
-
-namespace phpbb\db\driver;
-
-/**
-* MySQL4 Database Abstraction Layer
-* Compatible with:
-* MySQL 3.23+
-* MySQL 4.0+
-* MySQL 4.1+
-* MySQL 5.0+
-*/
-class mysql extends \phpbb\db\driver\mysql_base
-{
- var $multi_insert = true;
- var $connect_error = '';
-
- /**
- * {@inheritDoc}
- */
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
- {
- $this->persistency = $persistency;
- $this->user = $sqluser;
- $this->server = $sqlserver . (($port) ? ':' . $port : '');
- $this->dbname = $database;
-
- $this->sql_layer = 'mysql4';
-
- if ($this->persistency)
- {
- if (!function_exists('mysql_pconnect'))
- {
- $this->connect_error = 'mysql_pconnect function does not exist, is mysql extension installed?';
- return $this->sql_error('');
- }
- $this->db_connect_id = @mysql_pconnect($this->server, $this->user, $sqlpassword);
- }
- else
- {
- if (!function_exists('mysql_connect'))
- {
- $this->connect_error = 'mysql_connect function does not exist, is mysql extension installed?';
- return $this->sql_error('');
- }
- $this->db_connect_id = @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
- }
-
- if ($this->db_connect_id && $this->dbname != '')
- {
- if (@mysql_select_db($this->dbname, $this->db_connect_id))
- {
- // Determine what version we are using and if it natively supports UNICODE
- if (version_compare($this->sql_server_info(true), '4.1.0', '>='))
- {
- @mysql_query("SET NAMES 'utf8'", $this->db_connect_id);
-
- // enforce strict mode on databases that support it
- if (version_compare($this->sql_server_info(true), '5.0.2', '>='))
- {
- $result = @mysql_query('SELECT @@session.sql_mode AS sql_mode', $this->db_connect_id);
- if ($result)
- {
- $row = mysql_fetch_assoc($result);
- mysql_free_result($result);
- $modes = array_map('trim', explode(',', $row['sql_mode']));
- }
- else
- {
- $modes = array();
- }
-
- // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES
- if (!in_array('TRADITIONAL', $modes))
- {
- if (!in_array('STRICT_ALL_TABLES', $modes))
- {
- $modes[] = 'STRICT_ALL_TABLES';
- }
-
- if (!in_array('STRICT_TRANS_TABLES', $modes))
- {
- $modes[] = 'STRICT_TRANS_TABLES';
- }
- }
-
- $mode = implode(',', $modes);
- @mysql_query("SET SESSION sql_mode='{$mode}'", $this->db_connect_id);
- }
- }
- else if (version_compare($this->sql_server_info(true), '4.0.0', '<'))
- {
- $this->sql_layer = 'mysql';
- }
-
- return $this->db_connect_id;
- }
- }
-
- return $this->sql_error('');
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_server_info($raw = false, $use_cache = true)
- {
- global $cache;
-
- if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysql_version')) === false)
- {
- $result = @mysql_query('SELECT VERSION() AS version', $this->db_connect_id);
- if ($result)
- {
- $row = mysql_fetch_assoc($result);
- mysql_free_result($result);
-
- $this->sql_server_version = $row['version'];
-
- if (!empty($cache) && $use_cache)
- {
- $cache->put('mysql_version', $this->sql_server_version);
- }
- }
- }
-
- return ($raw) ? $this->sql_server_version : 'MySQL ' . $this->sql_server_version;
- }
-
- /**
- * SQL Transaction
- * @access private
- */
- function _sql_transaction($status = 'begin')
- {
- switch ($status)
- {
- case 'begin':
- return @mysql_query('BEGIN', $this->db_connect_id);
- break;
-
- case 'commit':
- return @mysql_query('COMMIT', $this->db_connect_id);
- break;
-
- case 'rollback':
- return @mysql_query('ROLLBACK', $this->db_connect_id);
- break;
- }
-
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_query($query = '', $cache_ttl = 0)
- {
- if ($query != '')
- {
- global $cache;
-
- if ($this->debug_sql_explain)
- {
- $this->sql_report('start', $query);
- }
- else if ($this->debug_load_time)
- {
- $this->curtime = microtime(true);
- }
-
- $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
- $this->sql_add_num_queries($this->query_result);
-
- if ($this->query_result === false)
- {
- if (($this->query_result = @mysql_query($query, $this->db_connect_id)) === false)
- {
- $this->sql_error($query);
- }
-
- if ($this->debug_sql_explain)
- {
- $this->sql_report('stop', $query);
- }
- else if ($this->debug_load_time)
- {
- $this->sql_time += microtime(true) - $this->curtime;
- }
-
- if (!$this->query_result)
- {
- return false;
- }
-
- if ($cache && $cache_ttl)
- {
- $this->open_queries[(int) $this->query_result] = $this->query_result;
- $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
- }
- else if (strpos($query, 'SELECT') === 0)
- {
- $this->open_queries[(int) $this->query_result] = $this->query_result;
- }
- }
- else if ($this->debug_sql_explain)
- {
- $this->sql_report('fromcache', $query);
- }
- }
- else
- {
- return false;
- }
-
- return $this->query_result;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_affectedrows()
- {
- if ($this->db_connect_id)
- {
- // We always want the number of matched rows
- // instead of changed rows, when running an update.
- // So when mysql_info() returns the number of matched rows
- // we return that one instead of mysql_affected_rows()
- $mysql_info = @mysql_info($this->db_connect_id);
- if ($mysql_info !== false)
- {
- $match = array();
- preg_match('#^Rows matched: (\d)+ Changed: (\d)+ Warnings: (\d)+$#', $mysql_info, $match);
- if (isset($match[1]))
- {
- return $match[1];
- }
- }
-
- return @mysql_affected_rows($this->db_connect_id);
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_fetchrow($query_id = false)
- {
- global $cache;
-
- if ($query_id === false)
- {
- $query_id = $this->query_result;
- }
-
- if ($cache && $cache->sql_exists($query_id))
- {
- return $cache->sql_fetchrow($query_id);
- }
-
- return ($query_id) ? mysql_fetch_assoc($query_id) : false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_rowseek($rownum, &$query_id)
- {
- global $cache;
-
- if ($query_id === false)
- {
- $query_id = $this->query_result;
- }
-
- if ($cache && $cache->sql_exists($query_id))
- {
- return $cache->sql_rowseek($rownum, $query_id);
- }
-
- return ($query_id !== false) ? @mysql_data_seek($query_id, $rownum) : false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_nextid()
- {
- return ($this->db_connect_id) ? @mysql_insert_id($this->db_connect_id) : false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_freeresult($query_id = false)
- {
- global $cache;
-
- if ($query_id === false)
- {
- $query_id = $this->query_result;
- }
-
- if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
- {
- return $cache->sql_freeresult($query_id);
- }
-
- if (isset($this->open_queries[(int) $query_id]))
- {
- unset($this->open_queries[(int) $query_id]);
- return mysql_free_result($query_id);
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_escape($msg)
- {
- if (!$this->db_connect_id)
- {
- return @mysql_real_escape_string($msg);
- }
-
- return @mysql_real_escape_string($msg, $this->db_connect_id);
- }
-
- /**
- * return sql error array
- * @access private
- */
- function _sql_error()
- {
- if ($this->db_connect_id)
- {
- $error = array(
- 'message' => @mysql_error($this->db_connect_id),
- 'code' => @mysql_errno($this->db_connect_id),
- );
- }
- else if (function_exists('mysql_error'))
- {
- $error = array(
- 'message' => @mysql_error(),
- 'code' => @mysql_errno(),
- );
- }
- else
- {
- $error = array(
- 'message' => $this->connect_error,
- 'code' => '',
- );
- }
-
- return $error;
- }
-
- /**
- * Close sql connection
- * @access private
- */
- function _sql_close()
- {
- return @mysql_close($this->db_connect_id);
- }
-
- /**
- * Build db-specific report
- * @access private
- */
- function _sql_report($mode, $query = '')
- {
- static $test_prof;
-
- // current detection method, might just switch to see the existence of INFORMATION_SCHEMA.PROFILING
- if ($test_prof === null)
- {
- $test_prof = false;
- if (version_compare($this->sql_server_info(true), '5.0.37', '>=') && version_compare($this->sql_server_info(true), '5.1', '<'))
- {
- $test_prof = true;
- }
- }
-
- switch ($mode)
- {
- case 'start':
-
- $explain_query = $query;
- if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m))
- {
- $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2];
- }
- else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m))
- {
- $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2];
- }
-
- if (preg_match('/^SELECT/', $explain_query))
- {
- $html_table = false;
-
- // begin profiling
- if ($test_prof)
- {
- @mysql_query('SET profiling = 1;', $this->db_connect_id);
- }
-
- if ($result = @mysql_query("EXPLAIN $explain_query", $this->db_connect_id))
- {
- while ($row = mysql_fetch_assoc($result))
- {
- $html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
- }
- mysql_free_result($result);
- }
-
- if ($html_table)
- {
- $this->html_hold .= '</table>';
- }
-
- if ($test_prof)
- {
- $html_table = false;
-
- // get the last profile
- if ($result = @mysql_query('SHOW PROFILE ALL;', $this->db_connect_id))
- {
- $this->html_hold .= '<br />';
- while ($row = mysql_fetch_assoc($result))
- {
- // make <unknown> HTML safe
- if (!empty($row['Source_function']))
- {
- $row['Source_function'] = str_replace(array('<', '>'), array('&lt;', '&gt;'), $row['Source_function']);
- }
-
- // remove unsupported features
- foreach ($row as $key => $val)
- {
- if ($val === null)
- {
- unset($row[$key]);
- }
- }
- $html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
- }
- mysql_free_result($result);
- }
-
- if ($html_table)
- {
- $this->html_hold .= '</table>';
- }
-
- @mysql_query('SET profiling = 0;', $this->db_connect_id);
- }
- }
-
- break;
-
- case 'fromcache':
- $endtime = explode(' ', microtime());
- $endtime = $endtime[0] + $endtime[1];
-
- $result = @mysql_query($query, $this->db_connect_id);
- if ($result)
- {
- while ($void = mysql_fetch_assoc($result))
- {
- // Take the time spent on parsing rows into account
- }
- mysql_free_result($result);
- }
-
- $splittime = explode(' ', microtime());
- $splittime = $splittime[0] + $splittime[1];
-
- $this->sql_report('record_fromcache', $query, $endtime, $splittime);
-
- break;
- }
- }
-}
diff --git a/phpBB/phpbb/db/extractor/mysql_extractor.php b/phpBB/phpbb/db/extractor/mysql_extractor.php
index 534e8b7653..f3cb0db457 100644
--- a/phpBB/phpbb/db/extractor/mysql_extractor.php
+++ b/phpBB/phpbb/db/extractor/mysql_extractor.php
@@ -79,14 +79,7 @@ class mysql_extractor extends base_extractor
throw new extractor_not_initialized_exception();
}
- if ($this->db->get_sql_layer() === 'mysqli')
- {
- $this->write_data_mysqli($table_name);
- }
- else
- {
- $this->write_data_mysql($table_name);
- }
+ $this->write_data_mysqli($table_name);
}
/**
@@ -180,101 +173,6 @@ class mysql_extractor extends base_extractor
}
/**
- * Extracts data from database table (for MySQL driver)
- *
- * @param string $table_name name of the database table
- * @return null
- * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor()
- */
- protected function write_data_mysql($table_name)
- {
- if (!$this->is_initialized)
- {
- throw new extractor_not_initialized_exception();
- }
-
- $sql = "SELECT *
- FROM $table_name";
- $result = mysql_unbuffered_query($sql, $this->db->get_db_connect_id());
-
- if ($result != false)
- {
- $fields_cnt = mysql_num_fields($result);
-
- // Get field information
- $field = array();
- for ($i = 0; $i < $fields_cnt; $i++)
- {
- $field[] = mysql_fetch_field($result, $i);
- }
- $field_set = array();
-
- for ($j = 0; $j < $fields_cnt; $j++)
- {
- $field_set[] = $field[$j]->name;
- }
-
- $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"');
- $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"');
- $fields = implode(', ', $field_set);
- $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES ';
- $first_set = true;
- $query_len = 0;
- $max_len = get_usable_memory();
-
- while ($row = mysql_fetch_row($result))
- {
- $values = array();
- if ($first_set)
- {
- $query = $sql_data . '(';
- }
- else
- {
- $query .= ',(';
- }
-
- for ($j = 0; $j < $fields_cnt; $j++)
- {
- if (!isset($row[$j]) || is_null($row[$j]))
- {
- $values[$j] = 'NULL';
- }
- else if ($field[$j]->numeric && ($field[$j]->type !== 'timestamp'))
- {
- $values[$j] = $row[$j];
- }
- else
- {
- $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'";
- }
- }
- $query .= implode(', ', $values) . ')';
-
- $query_len += strlen($query);
- if ($query_len > $max_len)
- {
- $this->flush($query . ";\n\n");
- $query = '';
- $query_len = 0;
- $first_set = true;
- }
- else
- {
- $first_set = false;
- }
- }
- mysql_free_result($result);
-
- // check to make sure we have nothing left to flush
- if (!$first_set && $query)
- {
- $this->flush($query . ";\n\n");
- }
- }
- }
-
- /**
* Extracts database table structure (for MySQLi or MySQL 3.23.20+)
*
* @param string $table_name name of the database table
diff --git a/phpBB/phpbb/db/tools/tools.php b/phpBB/phpbb/db/tools/tools.php
index d128df96c4..1250a8901d 100644
--- a/phpBB/phpbb/db/tools/tools.php
+++ b/phpBB/phpbb/db/tools/tools.php
@@ -74,37 +74,6 @@ class tools implements tools_interface
'VARBINARY' => 'varbinary(255)',
),
- 'mysql_40' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'ULINT' => 'INT(10) UNSIGNED',
- 'UINT' => 'mediumint(8) UNSIGNED',
- 'UINT:' => 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'smallint(4) UNSIGNED',
- 'BOOL' => 'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varbinary(255)',
- 'VCHAR:' => 'varbinary(%d)',
- 'CHAR:' => 'binary(%d)',
- 'XSTEXT' => 'blob',
- 'XSTEXT_UNI'=> 'blob',
- 'STEXT' => 'blob',
- 'STEXT_UNI' => 'blob',
- 'TEXT' => 'blob',
- 'TEXT_UNI' => 'blob',
- 'MTEXT' => 'mediumblob',
- 'MTEXT_UNI' => 'mediumblob',
- 'TIMESTAMP' => 'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'blob',
- 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')),
- 'VCHAR_CI' => 'blob',
- 'VARBINARY' => 'varbinary(255)',
- ),
-
'oracle' => array(
'INT:' => 'number(%d)',
'BINT' => 'number(20)',
@@ -197,21 +166,6 @@ class tools implements tools_interface
// Determine mapping database type
switch ($this->db->get_sql_layer())
{
- case 'mysql':
- $this->sql_layer = 'mysql_40';
- break;
-
- case 'mysql4':
- if (version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
- {
- $this->sql_layer = 'mysql_41';
- }
- else
- {
- $this->sql_layer = 'mysql_40';
- }
- break;
-
case 'mysqli':
$this->sql_layer = 'mysql_41';
break;
@@ -240,8 +194,6 @@ class tools implements tools_interface
{
switch ($this->db->get_sql_layer())
{
- case 'mysql':
- case 'mysql4':
case 'mysqli':
$sql = 'SHOW TABLES';
break;
@@ -359,7 +311,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
case 'sqlite3':
$table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')';
@@ -381,7 +332,6 @@ class tools implements tools_interface
$statements[] = $table_sql;
break;
- case 'mysql_40':
case 'sqlite3':
$table_sql .= "\n);";
$statements[] = $table_sql;
@@ -834,7 +784,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$sql = "SHOW COLUMNS FROM $table_name";
break;
@@ -911,7 +860,6 @@ class tools implements tools_interface
{
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$sql = 'SHOW KEYS
FROM ' . $table_name;
@@ -936,7 +884,7 @@ class tools implements tools_interface
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
- if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique'])
+ if ($this->sql_layer == 'mysql_41' && !$row['Non_unique'])
{
continue;
}
@@ -971,7 +919,6 @@ class tools implements tools_interface
{
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$sql = 'SHOW KEYS
FROM ' . $table_name;
@@ -996,7 +943,7 @@ class tools implements tools_interface
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
- if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && ($row['Non_unique'] || $row[$col] == 'PRIMARY'))
+ if ($this->sql_layer == 'mysql_41' && ($row['Non_unique'] || $row[$col] == 'PRIMARY'))
{
continue;
}
@@ -1094,7 +1041,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$sql .= " {$column_type} ";
@@ -1248,7 +1194,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$after = (!empty($column_data['after'])) ? ' AFTER ' . $column_data['after'] : '';
$statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'] . $after;
@@ -1281,7 +1226,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`';
break;
@@ -1360,7 +1304,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$index_name = $this->check_index_name_length($table_name, $index_name, false);
$statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name;
@@ -1422,7 +1365,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')';
break;
@@ -1500,7 +1442,6 @@ class tools implements tools_interface
$statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
break;
- case 'mysql_40':
case 'mysql_41':
$index_name = $this->check_index_name_length($table_name, $index_name);
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX ' . $index_name . '(' . implode(', ', $column) . ')';
@@ -1517,11 +1458,7 @@ class tools implements tools_interface
{
$statements = array();
- // remove index length unless MySQL4
- if ('mysql_40' != $this->sql_layer)
- {
- $column = preg_replace('#:.*$#', '', $column);
- }
+ $column = preg_replace('#:.*$#', '', $column);
switch ($this->sql_layer)
{
@@ -1531,17 +1468,6 @@ class tools implements tools_interface
$statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
break;
- case 'mysql_40':
- // add index size to definition as required by MySQL4
- foreach ($column as $i => $col)
- {
- if (false !== strpos($col, ':'))
- {
- list($col, $index_size) = explode(':', $col);
- $column[$i] = "$col($index_size)";
- }
- }
- // no break
case 'mysql_41':
$index_name = $this->check_index_name_length($table_name, $index_name);
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . ' (' . implode(', ', $column) . ')';
@@ -1609,7 +1535,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$sql = 'SHOW KEYS
FROM ' . $table_name;
@@ -1634,7 +1559,7 @@ class tools implements tools_interface
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
- if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique'])
+ if ($this->sql_layer == 'mysql_41' && !$row['Non_unique'])
{
continue;
}
@@ -1677,7 +1602,6 @@ class tools implements tools_interface
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
$statements[] = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql'];
break;
@@ -1826,7 +1750,6 @@ class tools implements tools_interface
{
switch ($this->sql_layer)
{
- case 'mysql_40':
case 'mysql_41':
case 'sqlite3':
// Not supported
diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php
index fa5a10c6fc..51fd18f874 100644
--- a/phpBB/phpbb/install/helper/database.php
+++ b/phpBB/phpbb/install/helper/database.php
@@ -45,15 +45,6 @@ class database
'AVAILABLE' => true,
'2.0.x' => true,
),
- 'mysql' => array(
- 'LABEL' => 'MySQL',
- 'SCHEMA' => 'mysql',
- 'MODULE' => 'mysql',
- 'DELIM' => ';',
- 'DRIVER' => 'phpbb\db\driver\mysql',
- 'AVAILABLE' => true,
- '2.0.x' => true,
- ),
'mssql_odbc'=> array(
'LABEL' => 'MS SQL Server [ ODBC ]',
'SCHEMA' => 'mssql',
@@ -256,7 +247,6 @@ class database
$dbms_info = $this->get_available_dbms($dbms);
switch ($dbms_info[$dbms]['SCHEMA'])
{
- case 'mysql':
case 'mysql_41':
$prefix_length = 36;
break;
@@ -382,14 +372,6 @@ class database
// Check if database version is supported
switch ($dbms)
{
- case 'mysqli':
- if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
- {
- $errors[] = array(
- 'title' => 'INST_ERR_DB_NO_MYSQLI',
- );
- }
- break;
case 'sqlite3':
if (version_compare($db->sql_server_info(true), '3.6.15', '<'))
{
diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php
index a5635d5dbe..983bb42122 100644
--- a/phpBB/phpbb/install/module/install_database/task/create_schema.php
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php
@@ -129,14 +129,7 @@ class create_schema extends \phpbb\install\task_base
if ($dbms === 'mysql')
{
- if (version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
- {
- $schema_name .= '_41';
- }
- else
- {
- $schema_name .= '_40';
- }
+ $schema_name .= '_41';
}
$db_schema_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql';
diff --git a/phpBB/phpbb/install/module/install_database/task/set_up_database.php b/phpBB/phpbb/install/module/install_database/task/set_up_database.php
index 49c8ea23ad..4da5ece228 100644
--- a/phpBB/phpbb/install/module/install_database/task/set_up_database.php
+++ b/phpBB/phpbb/install/module/install_database/task/set_up_database.php
@@ -102,14 +102,7 @@ class set_up_database extends \phpbb\install\task_base
if ($dbms === 'mysql')
{
- if (version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
- {
- $schema_name .= '_41';
- }
- else
- {
- $schema_name .= '_40';
- }
+ $schema_name .= '_41';
}
$this->schema_file_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql';
diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php
index 4d3e13663d..8bdc31e128 100644
--- a/phpBB/phpbb/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -154,7 +154,7 @@ class fulltext_mysql extends \phpbb\search\base
*/
public function init()
{
- if ($this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli')
+ if ($this->db->get_sql_layer() != 'mysqli')
{
return $this->user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_DATABASE'];
}
@@ -1005,14 +1005,7 @@ class fulltext_mysql extends \phpbb\search\base
if (!isset($this->stats['post_subject']))
{
$alter_entry = array();
- if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
- {
- $alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
- }
- else
- {
- $alter_entry[] = 'MODIFY post_subject text NOT NULL';
- }
+ $alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
$alter_entry[] = 'ADD FULLTEXT (post_subject)';
$alter_list[] = $alter_entry;
}
@@ -1020,15 +1013,7 @@ class fulltext_mysql extends \phpbb\search\base
if (!isset($this->stats['post_content']))
{
$alter_entry = array();
- if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
- {
- $alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
- }
- else
- {
- $alter_entry[] = 'MODIFY post_text mediumtext NOT NULL';
- }
-
+ $alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
$alter_entry[] = 'ADD FULLTEXT post_content (post_text, post_subject)';
$alter_list[] = $alter_entry;
}
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index ecebbd37cd..295c2cf33c 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -889,7 +889,6 @@ class fulltext_native extends \phpbb\search\base
switch ($this->db->get_sql_layer())
{
- case 'mysql4':
case 'mysqli':
// 3.x does not support SQL_CALC_FOUND_ROWS
@@ -1184,7 +1183,6 @@ class fulltext_native extends \phpbb\search\base
{
switch ($this->db->get_sql_layer())
{
- case 'mysql4':
case 'mysqli':
// $select = 'SQL_CALC_FOUND_ROWS ' . $select;
$is_mysql = true;
diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index d8331d3815..6230f92da3 100644
--- a/phpBB/phpbb/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -214,7 +214,7 @@ class fulltext_sphinx
*/
public function init()
{
- if ($this->db->get_sql_layer() != 'mysql' && $this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres')
+ if ($this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres')
{
return $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE'];
}
@@ -233,7 +233,7 @@ class fulltext_sphinx
protected function config_generate()
{
// Check if Database is supported by Sphinx
- if ($this->db->get_sql_layer() =='mysql' || $this->db->get_sql_layer() == 'mysql4' || $this->db->get_sql_layer() == 'mysqli')
+ if ($this->db->get_sql_layer() == 'mysqli')
{
$this->dbtype = 'mysql';
}
diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md
index 56f2818078..6e9171e7ed 100644
--- a/tests/RUNNING_TESTS.md
+++ b/tests/RUNNING_TESTS.md
@@ -34,7 +34,6 @@ will be skipped:
- apcu (APCu cache driver - native API, php7+)
- apcu_bc, apcu (APCu cache driver - APC API, php7+)
- bz2 (compress tests)
-- mysql, pdo_mysql (MySQL database driver)
- mysqli, pdo_mysql (MySQLi database driver)
- pcntl (flock class)
- pdo (any database tests)
diff --git a/tests/di/fixtures/config.php b/tests/di/fixtures/config.php
index 1e9207d924..d6b8a567c7 100644
--- a/tests/di/fixtures/config.php
+++ b/tests/di/fixtures/config.php
@@ -1,7 +1,7 @@
<?php
// phpBB 3.1.x auto-generated configuration file
// Do not change anything in this file!
-$dbms = 'mysql';
+$dbms = 'mysqli';
$dbhost = '127.0.0.1';
$dbport = '';
$dbname = 'phpbb';
diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php
index 456eb64461..05c42610bb 100644
--- a/tests/functions/convert_30_dbms_to_31_test.php
+++ b/tests/functions/convert_30_dbms_to_31_test.php
@@ -18,7 +18,6 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case
return array(
array('mssql_odbc'),
array('mssqlnative'),
- array('mysql'),
array('mysqli'),
array('oracle'),
array('postgres'),
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index f3adbefc1b..fec4709fbd 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -150,7 +150,6 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb\db\driver\mysql':
case 'phpbb\db\driver\mysqli':
$this->pdo->exec('SET NAMES utf8');
@@ -270,7 +269,6 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb\db\driver\mysql':
case 'phpbb\db\driver\mysqli':
$sql = 'SHOW TABLES';
break;
@@ -336,14 +334,7 @@ class phpbb_database_test_connection_manager
$sth = $this->pdo->query('SELECT VERSION() AS version');
$row = $sth->fetch(PDO::FETCH_ASSOC);
- if (version_compare($row['version'], '4.1.3', '>='))
- {
- $schema .= '_41';
- }
- else
- {
- $schema .= '_40';
- }
+ $schema .= '_41';
}
$filename = $directory . $schema . '_schema.sql';
@@ -424,11 +415,6 @@ class phpbb_database_test_connection_manager
'DELIM' => ';',
'PDO' => 'mysql',
),
- 'phpbb\db\driver\mysql' => array(
- 'SCHEMA' => 'mysql',
- 'DELIM' => ';',
- 'PDO' => 'mysql',
- ),
'phpbb\db\driver\mssql' => array(
'SCHEMA' => 'mssql',
'DELIM' => 'GO',
diff --git a/travis/setup-database.sh b/travis/setup-database.sh
index cbd5e93e83..b581ddfccb 100755
--- a/travis/setup-database.sh
+++ b/travis/setup-database.sh
@@ -31,7 +31,7 @@ then
mysql -e 'SET GLOBAL storage_engine=MyISAM;'
fi
-if [ "$DB" == "mysql" -o "$DB" == "mysqli" -o "$DB" == "mariadb" ]
+if [ "$DB" == "mysqli" -o "$DB" == "mariadb" ]
then
mysql -e 'create database IF NOT EXISTS phpbb_tests;'
fi