aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2020-05-09 01:15:08 +0200
committerMaat <maat-pub@mageia.biz>2020-05-09 01:15:08 +0200
commit6985226b17e8a0ef0a720bf1d12fe0c216e13dab (patch)
tree116d2565ac02c40abe0548863c6badf8ec3e1d1e /phpBB/phpbb/db
parent8ea437e30605e0f66b5220bf904a61d7c1d11ddd (diff)
parent8d00784dfe2c8bcb10843ff70b4cfa998d703285 (diff)
downloadforums-master.tar
forums-master.tar.gz
forums-master.tar.bz2
forums-master.tar.xz
forums-master.zip
Merge remote-tracking branch 'upstream/prep-release-3.3.0'HEADmaster
Diffstat (limited to 'phpBB/phpbb/db')
-rw-r--r--phpBB/phpbb/db/driver/driver.php28
-rw-r--r--phpBB/phpbb/db/driver/driver_interface.php14
-rw-r--r--phpBB/phpbb/db/driver/factory.php16
-rw-r--r--phpBB/phpbb/db/driver/mssql_odbc.php11
-rw-r--r--phpBB/phpbb/db/driver/mssqlnative.php11
-rw-r--r--phpBB/phpbb/db/driver/mysql.php503
-rw-r--r--phpBB/phpbb/db/driver/mysqli.php13
-rw-r--r--phpBB/phpbb/db/driver/oracle.php11
-rw-r--r--phpBB/phpbb/db/driver/postgres.php11
-rw-r--r--phpBB/phpbb/db/driver/sqlite3.php11
-rw-r--r--phpBB/phpbb/db/extractor/mysql_extractor.php106
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v310/softdelete_p1.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php34
-rw-r--r--phpBB/phpbb/db/migration/data/v330/dev.php36
-rw-r--r--phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php49
-rw-r--r--phpBB/phpbb/db/migration/data/v330/jquery_update.php37
-rw-r--r--phpBB/phpbb/db/migration/data/v330/remove_attachment_flash.php89
-rw-r--r--phpBB/phpbb/db/migration/data/v330/remove_email_hash.php62
-rw-r--r--phpBB/phpbb/db/migration/data/v330/remove_max_pass_chars.php43
-rw-r--r--phpBB/phpbb/db/migration/data/v330/reset_password.php48
-rw-r--r--phpBB/phpbb/db/migration/data/v330/v330.php37
-rw-r--r--phpBB/phpbb/db/migration/data/v330/v330b1.php41
-rw-r--r--phpBB/phpbb/db/migration/data/v330/v330b2.php39
-rw-r--r--phpBB/phpbb/db/migration/data/v330/v330rc1.php36
-rw-r--r--phpBB/phpbb/db/migration/tool/module.php2
-rw-r--r--phpBB/phpbb/db/migrator.php2
-rw-r--r--phpBB/phpbb/db/tools.php21
-rw-r--r--phpBB/phpbb/db/tools/mssql.php2
-rw-r--r--phpBB/phpbb/db/tools/postgres.php2
-rw-r--r--phpBB/phpbb/db/tools/tools.php87
31 files changed, 652 insertions, 754 deletions
diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php
index a36ce8c0d7..93f0a749e5 100644
--- a/phpBB/phpbb/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -76,6 +76,16 @@ abstract class driver implements driver_interface
const SUBQUERY_BUILD = 5;
/**
+ * @var bool
+ */
+ protected $debug_load_time = false;
+
+ /**
+ * @var bool
+ */
+ protected $debug_sql_explain = false;
+
+ /**
* Constructor
*/
function __construct()
@@ -98,6 +108,22 @@ abstract class driver implements driver_interface
/**
* {@inheritdoc}
*/
+ public function set_debug_load_time($value)
+ {
+ $this->debug_load_time = $value;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_debug_sql_explain($value)
+ {
+ $this->debug_sql_explain = $value;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function get_sql_layer()
{
return $this->sql_layer;
@@ -955,7 +981,7 @@ abstract class driver implements driver_interface
// Show complete SQL error and path to administrators only
// Additionally show complete error on installation or if extended debug mode is enabled
// The DEBUG constant is for development only!
- if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG'))
+ if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || $this->debug_sql_explain)
{
$message .= ($sql) ? '<br /><br />SQL<br /><br />' . htmlspecialchars($sql) : '';
}
diff --git a/phpBB/phpbb/db/driver/driver_interface.php b/phpBB/phpbb/db/driver/driver_interface.php
index 8b487c5d42..05ff5ef066 100644
--- a/phpBB/phpbb/db/driver/driver_interface.php
+++ b/phpBB/phpbb/db/driver/driver_interface.php
@@ -16,6 +16,20 @@ namespace phpbb\db\driver;
interface driver_interface
{
/**
+ * Set value for load_time debug parameter
+ *
+ * @param bool $value
+ */
+ public function set_debug_load_time($value);
+
+ /**
+ * Set value for sql_explain debug parameter
+ *
+ * @param bool $value
+ */
+ public function set_debug_sql_explain($value);
+
+ /**
* Gets the name of the sql layer.
*
* @return string
diff --git a/phpBB/phpbb/db/driver/factory.php b/phpBB/phpbb/db/driver/factory.php
index fb3a826254..bb6e7a2682 100644
--- a/phpBB/phpbb/db/driver/factory.php
+++ b/phpBB/phpbb/db/driver/factory.php
@@ -68,6 +68,22 @@ class factory implements driver_interface
/**
* {@inheritdoc}
*/
+ public function set_debug_load_time($value)
+ {
+ $this->get_driver()->set_debug_load_time($value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_debug_sql_explain($value)
+ {
+ $this->get_driver()->set_debug_sql_explain($value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function get_sql_layer()
{
return $this->get_driver()->get_sql_layer();
diff --git a/phpBB/phpbb/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php
index 9d9ad603e0..06cdce7a15 100644
--- a/phpBB/phpbb/db/driver/mssql_odbc.php
+++ b/phpBB/phpbb/db/driver/mssql_odbc.php
@@ -151,12 +151,11 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
{
global $cache;
- // EXPLAIN only in extra debug mode
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('start', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->curtime = microtime(true);
}
@@ -172,11 +171,11 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
$this->sql_error($query);
}
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('stop', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->sql_time += microtime(true) - $this->curtime;
}
@@ -196,7 +195,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
- else if (defined('DEBUG'))
+ else if ($this->debug_sql_explain)
{
$this->sql_report('fromcache', $query);
}
diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php
index a4dcac5966..30ef9d9bc4 100644
--- a/phpBB/phpbb/db/driver/mssqlnative.php
+++ b/phpBB/phpbb/db/driver/mssqlnative.php
@@ -123,12 +123,11 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
{
global $cache;
- // EXPLAIN only in extra debug mode
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('start', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->curtime = microtime(true);
}
@@ -146,11 +145,11 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
// reset options for next query
$this->query_options = array();
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('stop', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->sql_time += microtime(true) - $this->curtime;
}
@@ -170,7 +169,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
- else if (defined('DEBUG'))
+ else if ($this->debug_sql_explain)
{
$this->sql_report('fromcache', $query);
}
diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php
deleted file mode 100644
index a94e88b331..0000000000
--- a/phpBB/phpbb/db/driver/mysql.php
+++ /dev/null
@@ -1,503 +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;
-
- // EXPLAIN only in extra debug mode
- if (defined('DEBUG'))
- {
- $this->sql_report('start', $query);
- }
- else if (defined('PHPBB_DISPLAY_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 (defined('DEBUG'))
- {
- $this->sql_report('stop', $query);
- }
- else if (defined('PHPBB_DISPLAY_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 (defined('DEBUG'))
- {
- $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 existance 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/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php
index b429ad97aa..0c1c063262 100644
--- a/phpBB/phpbb/db/driver/mysqli.php
+++ b/phpBB/phpbb/db/driver/mysqli.php
@@ -176,12 +176,11 @@ class mysqli extends \phpbb\db\driver\mysql_base
{
global $cache;
- // EXPLAIN only in extra debug mode
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('start', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->curtime = microtime(true);
}
@@ -196,11 +195,11 @@ class mysqli extends \phpbb\db\driver\mysql_base
$this->sql_error($query);
}
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('stop', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->sql_time += microtime(true) - $this->curtime;
}
@@ -215,7 +214,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
}
}
- else if (defined('DEBUG'))
+ else if ($this->debug_sql_explain)
{
$this->sql_report('fromcache', $query);
}
@@ -376,7 +375,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
{
static $test_prof;
- // current detection method, might just switch to see the existance of INFORMATION_SCHEMA.PROFILING
+ // current detection method, might just switch to see the existence of INFORMATION_SCHEMA.PROFILING
if ($test_prof === null)
{
$test_prof = false;
diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php
index 5fd14709f8..f2a0bb557a 100644
--- a/phpBB/phpbb/db/driver/oracle.php
+++ b/phpBB/phpbb/db/driver/oracle.php
@@ -246,12 +246,11 @@ class oracle extends \phpbb\db\driver\driver
{
global $cache;
- // EXPLAIN only in extra debug mode
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('start', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->curtime = microtime(true);
}
@@ -428,11 +427,11 @@ class oracle extends \phpbb\db\driver\driver
}
}
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('stop', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->sql_time += microtime(true) - $this->curtime;
}
@@ -452,7 +451,7 @@ class oracle extends \phpbb\db\driver\driver
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
- else if (defined('DEBUG'))
+ else if ($this->debug_sql_explain)
{
$this->sql_report('fromcache', $query);
}
diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php
index 44476612c3..ed330bc540 100644
--- a/phpBB/phpbb/db/driver/postgres.php
+++ b/phpBB/phpbb/db/driver/postgres.php
@@ -173,12 +173,11 @@ class postgres extends \phpbb\db\driver\driver
{
global $cache;
- // EXPLAIN only in extra debug mode
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('start', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->curtime = microtime(true);
}
@@ -194,11 +193,11 @@ class postgres extends \phpbb\db\driver\driver
$this->sql_error($query);
}
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('stop', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->sql_time += microtime(true) - $this->curtime;
}
@@ -218,7 +217,7 @@ class postgres extends \phpbb\db\driver\driver
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
- else if (defined('DEBUG'))
+ else if ($this->debug_sql_explain)
{
$this->sql_report('fromcache', $query);
}
diff --git a/phpBB/phpbb/db/driver/sqlite3.php b/phpBB/phpbb/db/driver/sqlite3.php
index 0508500c52..43906f1b58 100644
--- a/phpBB/phpbb/db/driver/sqlite3.php
+++ b/phpBB/phpbb/db/driver/sqlite3.php
@@ -118,12 +118,11 @@ class sqlite3 extends \phpbb\db\driver\driver
{
global $cache;
- // EXPLAIN only in extra debug mode
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('start', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->curtime = microtime(true);
}
@@ -156,11 +155,11 @@ class sqlite3 extends \phpbb\db\driver\driver
}
}
- if (defined('DEBUG'))
+ if ($this->debug_sql_explain)
{
$this->sql_report('stop', $query);
}
- else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
+ else if ($this->debug_load_time)
{
$this->sql_time += microtime(true) - $this->curtime;
}
@@ -175,7 +174,7 @@ class sqlite3 extends \phpbb\db\driver\driver
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
}
}
- else if (defined('DEBUG'))
+ else if ($this->debug_sql_explain)
{
$this->sql_report('fromcache', $query);
}
diff --git a/phpBB/phpbb/db/extractor/mysql_extractor.php b/phpBB/phpbb/db/extractor/mysql_extractor.php
index 34e309c19e..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
@@ -300,7 +198,7 @@ class mysql_extractor extends base_extractor
}
/**
- * Extracts database table structure (for MySQL verisons older than 3.23.20)
+ * Extracts database table structure (for MySQL versions older than 3.23.20)
*
* @param string $table_name name of the database table
* @return null
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
index 10343438b3..247ccc7a76 100644
--- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
@@ -117,7 +117,7 @@ class release_3_0_4_rc1 extends \phpbb\db\migration\migration
}
else
{
- // equivelant to "none", which is the "Display in user control panel" option
+ // equivalent to "none", which is the "Display in user control panel" option
$sql_ary['field_show_profile'] = 1;
}
diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php
index b1e7486e24..877cdc2fa3 100644
--- a/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php
+++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php
@@ -132,7 +132,7 @@ class softdelete_p1 extends \phpbb\db\migration\migration
/*
* Using sql_case here to avoid "BIGINT UNSIGNED value is out of range" errors.
* As we update all topics in 2 queries, one broken topic would stop the conversion
- * for all topics and the surpressed error will cause the admin to not even notice it.
+ * for all topics and the suppressed error will cause the admin to not even notice it.
*/
$sql = 'UPDATE ' . $this->table_prefix . 'topics
SET topic_posts_approved = topic_replies + 1,
diff --git a/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php b/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php
new file mode 100644
index 0000000000..209aba3646
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php
@@ -0,0 +1,34 @@
+<?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\migration\data\v330;
+
+class add_display_unapproved_posts_config extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return $this->config->offsetExists('display_unapproved_posts');
+ }
+
+ public static function depends_on()
+ {
+ return ['\phpbb\db\migration\data\v330\dev',];
+ }
+
+ public function update_data()
+ {
+ return [
+ ['config.add', ['display_unapproved_posts', 1]],
+ ];
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/dev.php b/phpBB/phpbb/db/migration/data/v330/dev.php
new file mode 100644
index 0000000000..209f9fc7ec
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/dev.php
@@ -0,0 +1,36 @@
+<?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\migration\data\v330;
+
+class dev extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.3.0-dev', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v32x\v327',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.3.0-dev')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php b/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php
new file mode 100644
index 0000000000..c5a4beef38
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php
@@ -0,0 +1,49 @@
+<?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\migration\data\v330;
+
+class forums_legend_limit extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return $this->db_tools->sql_column_exists($this->table_prefix . 'forums', 'display_subforum_limit');
+ }
+
+ static public function depends_on()
+ {
+ return ['\phpbb\db\migration\data\v330\v330b1'];
+ }
+
+ public function update_schema()
+ {
+ return [
+ 'add_columns' => [
+ $this->table_prefix . 'forums' => [
+ 'display_subforum_limit' => ['BOOL', 0, 'after' => 'display_subforum_list'],
+ ],
+ ],
+ ];
+ }
+
+ public function revert_schema()
+ {
+ return [
+ 'drop_columns' => [
+ $this->table_prefix . 'forums' => [
+ 'display_subforum_limit',
+ ],
+ ],
+ ];
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/jquery_update.php b/phpBB/phpbb/db/migration/data/v330/jquery_update.php
new file mode 100644
index 0000000000..f1ac6cdd41
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/jquery_update.php
@@ -0,0 +1,37 @@
+<?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\migration\data\v330;
+
+class jquery_update extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return $this->config['load_jquery_url'] === '//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js';
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v330\dev',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js')),
+ );
+ }
+
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/remove_attachment_flash.php b/phpBB/phpbb/db/migration/data/v330/remove_attachment_flash.php
new file mode 100644
index 0000000000..c136960905
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/remove_attachment_flash.php
@@ -0,0 +1,89 @@
+<?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\migration\data\v330;
+
+class remove_attachment_flash extends \phpbb\db\migration\migration
+{
+ // Following constants were deprecated in 3.3
+ // and moved from constants.php to compatibility_globals.php,
+ // thus define them as class constants
+ const ATTACHMENT_CATEGORY_FLASH = 5;
+
+ protected $cat_id = array(
+ self::ATTACHMENT_CATEGORY_FLASH,
+ );
+
+ public static function depends_on()
+ {
+ return ['\phpbb\db\migration\data\v330\dev',];
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(array($this, 'remove_flash_group'))),
+ );
+ }
+
+ public function remove_flash_group()
+ {
+ // select group ids of outdated media
+ $sql = 'SELECT group_id
+ FROM ' . EXTENSION_GROUPS_TABLE . '
+ WHERE ' . $this->db->sql_in_set('cat_id', $this->cat_id);
+ $result = $this->db->sql_query($sql);
+
+ $group_ids = array();
+ while ($group_id = (int) $this->db->sql_fetchfield('group_id'))
+ {
+ $group_ids[] = $group_id;
+ }
+ $this->db->sql_freeresult($result);
+
+ // nothing to do, admin has removed all the outdated media extension groups
+ if (empty($group_ids))
+ {
+ return true;
+ }
+
+ // get the group id of downloadable files
+ $sql = 'SELECT group_id
+ FROM ' . EXTENSION_GROUPS_TABLE . "
+ WHERE group_name = 'DOWNLOADABLE_FILES'";
+ $result = $this->db->sql_query($sql);
+ $download_id = (int) $this->db->sql_fetchfield('group_id');
+ $this->db->sql_freeresult($result);
+
+ if (empty($download_id))
+ {
+ $sql = 'UPDATE ' . EXTENSIONS_TABLE . '
+ SET group_id = 0
+ WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
+ }
+ else
+ {
+ // move outdated media extensions to downloadable files
+ $sql = 'UPDATE ' . EXTENSIONS_TABLE . "
+ SET group_id = $download_id" . '
+ WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
+ }
+
+ $this->db->sql_query($sql);
+
+ // delete the now empty, outdated media extension groups
+ $sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . '
+ WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
+ $this->db->sql_query($sql);
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/remove_email_hash.php b/phpBB/phpbb/db/migration/data/v330/remove_email_hash.php
new file mode 100644
index 0000000000..8ac8f4ed72
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/remove_email_hash.php
@@ -0,0 +1,62 @@
+<?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\migration\data\v330;
+
+class remove_email_hash extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return ['\phpbb\db\migration\data\v30x\release_3_0_0'];
+ }
+
+ public function update_schema()
+ {
+ return [
+ 'add_index' => [
+ $this->table_prefix . 'users' => [
+ 'user_email' => ['user_email'],
+ ],
+ ],
+ 'drop_keys' => [
+ $this->table_prefix . 'users' => [
+ 'user_email_hash',
+ ],
+ ],
+ 'drop_columns' => [
+ $this->table_prefix . 'users' => ['user_email_hash'],
+ ],
+ ];
+ }
+
+ public function revert_schema()
+ {
+ return [
+ 'add_columns' => [
+ $this->table_prefix . 'users' => [
+ 'user_email_hash' => ['BINT', 0],
+ ],
+ ],
+ 'add_index' => [
+ $this->table_prefix . 'users' => [
+ 'user_email_hash',
+ ],
+ ],
+ 'drop_keys' => [
+ $this->table_prefix . 'users' => [
+ 'user_email' => ['user_email'],
+ ],
+ ],
+ ];
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/remove_max_pass_chars.php b/phpBB/phpbb/db/migration/data/v330/remove_max_pass_chars.php
new file mode 100644
index 0000000000..10e5ee385d
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/remove_max_pass_chars.php
@@ -0,0 +1,43 @@
+<?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\migration\data\v330;
+
+class remove_max_pass_chars extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return !$this->config->offsetExists('max_pass_chars');
+ }
+
+ public static function depends_on()
+ {
+ return [
+ '\phpbb\db\migration\data\v330\dev',
+ ];
+ }
+
+ public function update_data()
+ {
+ return [
+ ['config.remove', ['max_pass_chars']],
+ ];
+ }
+
+ public function revert_data()
+ {
+ return [
+ ['config.add', ['max_pass_chars', 100]],
+ ];
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/reset_password.php b/phpBB/phpbb/db/migration/data/v330/reset_password.php
new file mode 100644
index 0000000000..953d478ccc
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/reset_password.php
@@ -0,0 +1,48 @@
+<?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\migration\data\v330;
+
+class reset_password extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return [
+ '\phpbb\db\migration\data\v330\dev',
+ ];
+ }
+
+ public function update_schema()
+ {
+ return [
+ 'add_columns' => [
+ $this->table_prefix . 'users' => [
+ 'reset_token' => ['VCHAR:64', '', 'after' => 'user_actkey'],
+ 'reset_token_expiration' => ['TIMESTAMP', 0, 'after' => 'reset_token'],
+ ],
+ ],
+ ];
+ }
+
+ public function revert_schema()
+ {
+ return [
+ 'drop_columns' => [
+ $this->table_prefix . 'users' => [
+ 'reset_token',
+ 'reset_token_expiration',
+ ],
+ ],
+ ];
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/v330.php b/phpBB/phpbb/db/migration/data/v330/v330.php
new file mode 100644
index 0000000000..05baffbdbd
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/v330.php
@@ -0,0 +1,37 @@
+<?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\migration\data\v330;
+
+class v330 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.3.0', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v32x\v329',
+ '\phpbb\db\migration\data\v330\v330rc1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.3.0')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/v330b1.php b/phpBB/phpbb/db/migration/data/v330/v330b1.php
new file mode 100644
index 0000000000..3df44504fc
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/v330b1.php
@@ -0,0 +1,41 @@
+<?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\migration\data\v330;
+
+class v330b1 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.3.0-b1', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v330\jquery_update',
+ '\phpbb\db\migration\data\v330\reset_password',
+ '\phpbb\db\migration\data\v330\remove_attachment_flash',
+ '\phpbb\db\migration\data\v330\remove_max_pass_chars',
+ '\phpbb\db\migration\data\v32x\v328',
+ '\phpbb\db\migration\data\v330\dev',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.3.0-b1')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/v330b2.php b/phpBB/phpbb/db/migration/data/v330/v330b2.php
new file mode 100644
index 0000000000..cb2198aad7
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/v330b2.php
@@ -0,0 +1,39 @@
+<?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\migration\data\v330;
+
+class v330b2 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.3.0-b2', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v330\add_display_unapproved_posts_config',
+ '\phpbb\db\migration\data\v330\forums_legend_limit',
+ '\phpbb\db\migration\data\v330\remove_email_hash',
+ '\phpbb\db\migration\data\v330\v330b1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.3.0-b2')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v330/v330rc1.php b/phpBB/phpbb/db/migration/data/v330/v330rc1.php
new file mode 100644
index 0000000000..52193750cc
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/v330rc1.php
@@ -0,0 +1,36 @@
+<?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\migration\data\v330;
+
+class v330rc1 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.3.0-RC1', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v330\v330b2',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.3.0-RC1')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php
index e5133c8152..93c338437e 100644
--- a/phpBB/phpbb/db/migration/tool/module.php
+++ b/phpBB/phpbb/db/migration/tool/module.php
@@ -509,7 +509,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
* Get parent module id
*
* @param string|int $parent_id The parent module_id|module_langname
- * @param int|string|array $data The module_id, module_langname for existance checking or module data array for adding
+ * @param int|string|array $data The module_id, module_langname for existence checking or module data array for adding
* @param bool $throw_exception The flag indicating if exception should be thrown on error
* @return mixed The int parent module_id, an array of int parent module_id values or false
* @throws \phpbb\db\migration\exception
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 2b0c66fc58..3a1ee758cf 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -784,7 +784,7 @@ class migrator
{
return array(
$parameters[0],
- array($last_result),
+ isset($parameters[1]) ? array_merge($parameters[1], array($last_result)) : array($last_result),
);
}
break;
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
deleted file mode 100644
index 4d1b91f7b4..0000000000
--- a/phpBB/phpbb/db/tools.php
+++ /dev/null
@@ -1,21 +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;
-
-/**
- * @deprecated 3.2.0-dev (To be removed 3.3.0) use \phpbb\db\tools\tools instead
- */
-class tools extends \phpbb\db\tools\tools
-{
-}
diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php
index cbedf9a5c4..29f816a869 100644
--- a/phpBB/phpbb/db/tools/mssql.php
+++ b/phpBB/phpbb/db/tools/mssql.php
@@ -194,7 +194,7 @@ class mssql extends tools
$primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set'];
}
- // create sequence DDL based off of the existance of auto incrementing columns
+ // create sequence DDL based off of the existence of auto incrementing columns
if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'])
{
$create_sequence = $column_name;
diff --git a/phpBB/phpbb/db/tools/postgres.php b/phpBB/phpbb/db/tools/postgres.php
index 077d6e06f9..276ac135be 100644
--- a/phpBB/phpbb/db/tools/postgres.php
+++ b/phpBB/phpbb/db/tools/postgres.php
@@ -141,7 +141,7 @@ class postgres extends tools
$primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set'];
}
- // create sequence DDL based off of the existance of auto incrementing columns
+ // create sequence DDL based off of the existence of auto incrementing columns
if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'])
{
$create_sequence = $column_name;
diff --git a/phpBB/phpbb/db/tools/tools.php b/phpBB/phpbb/db/tools/tools.php
index c3352a1f66..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;
@@ -335,7 +287,7 @@ class tools implements tools_interface
$primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set'];
}
- // create sequence DDL based off of the existance of auto incrementing columns
+ // create sequence DDL based off of the existence of auto incrementing columns
if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'])
{
$create_sequence = $column_name;
@@ -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