aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/db')
-rw-r--r--phpBB/phpbb/db/driver/driver.php12
-rw-r--r--phpBB/phpbb/db/driver/firebird.php12
-rw-r--r--phpBB/phpbb/db/driver/mssql.php18
-rw-r--r--phpBB/phpbb/db/driver/mssql_base.php10
-rw-r--r--phpBB/phpbb/db/driver/mssql_odbc.php12
-rw-r--r--phpBB/phpbb/db/driver/mssqlnative.php186
-rw-r--r--phpBB/phpbb/db/driver/mysql.php12
-rw-r--r--phpBB/phpbb/db/driver/mysql_base.php10
-rw-r--r--phpBB/phpbb/db/driver/mysqli.php18
-rw-r--r--phpBB/phpbb/db/driver/oracle.php12
-rw-r--r--phpBB/phpbb/db/driver/postgres.php22
-rw-r--r--phpBB/phpbb/db/driver/sqlite.php12
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php (renamed from phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_10.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_11.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php33
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php)10
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php33
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php33
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_3.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_4.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php)10
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_5.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php)10
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php)10
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_7.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_8.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php42
-rw-r--r--phpBB/phpbb/db/migration/data/v310/allow_cdn.php33
-rw-r--r--phpBB/phpbb/db/migration/data/v310/alpha1.php44
-rw-r--r--phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php73
-rw-r--r--phpBB/phpbb/db/migration/data/v310/avatars.php (renamed from phpBB/phpbb/db/migration/data/310/avatars.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/boardindex.php (renamed from phpBB/phpbb/db/migration/data/310/boardindex.php)4
-rw-r--r--phpBB/phpbb/db/migration/data/v310/config_db_text.php (renamed from phpBB/phpbb/db/migration/data/310/config_db_text.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/dev.php (renamed from phpBB/phpbb/db/migration/data/310/dev.php)14
-rw-r--r--phpBB/phpbb/db/migration/data/v310/extensions.php (renamed from phpBB/phpbb/db/migration/data/310/extensions.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/forgot_password.php (renamed from phpBB/phpbb/db/migration/data/310/forgot_password.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/jquery_update.php (renamed from phpBB/phpbb/db/migration/data/310/jquery_update.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/mod_rewrite.php27
-rw-r--r--phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php47
-rw-r--r--phpBB/phpbb/db/migration/data/v310/namespaces.php30
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php (renamed from phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php)49
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications.php (renamed from phpBB/phpbb/db/migration/data/310/notifications.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications_cron.php27
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php (renamed from phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php)12
-rw-r--r--phpBB/phpbb/db/migration/data/v310/plupload.php32
-rw-r--r--phpBB/phpbb/db/migration/data/v310/reported_posts_display.php (renamed from phpBB/phpbb/db/migration/data/310/reported_posts_display.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/signature_module_auth.php (renamed from phpBB/phpbb/db/migration/data/310/signature_module_auth.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php57
-rw-r--r--phpBB/phpbb/db/migration/data/v310/softdelete_p1.php (renamed from phpBB/phpbb/db/migration/data/310/softdelete_p1.php)43
-rw-r--r--phpBB/phpbb/db/migration/data/v310/softdelete_p2.php (renamed from phpBB/phpbb/db/migration/data/310/softdelete_p2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/style_update_p1.php (renamed from phpBB/phpbb/db/migration/data/310/style_update_p1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/style_update_p2.php (renamed from phpBB/phpbb/db/migration/data/310/style_update_p2.php)14
-rw-r--r--phpBB/phpbb/db/migration/data/v310/teampage.php (renamed from phpBB/phpbb/db/migration/data/310/teampage.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/timezone.php (renamed from phpBB/phpbb/db/migration/data/310/timezone.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/timezone_p2.php (renamed from phpBB/phpbb/db/migration/data/310/timezone_p2.php)6
-rw-r--r--phpBB/phpbb/db/migration/exception.php18
-rw-r--r--phpBB/phpbb/db/migration/migration.php24
-rw-r--r--phpBB/phpbb/db/migration/tool/config.php14
-rw-r--r--phpBB/phpbb/db/migration/tool/module.php41
-rw-r--r--phpBB/phpbb/db/migration/tool/permission.php26
-rw-r--r--phpBB/phpbb/db/migration/tool/tool_interface.php (renamed from phpBB/phpbb/db/migration/tool/interface.php)4
-rw-r--r--phpBB/phpbb/db/migrator.php58
-rw-r--r--phpBB/phpbb/db/sql_insert_buffer.php18
-rw-r--r--phpBB/phpbb/db/tools.php510
90 files changed, 1253 insertions, 831 deletions
diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php
index 08c966c07a..58d0b61519 100644
--- a/phpBB/phpbb/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -7,19 +7,13 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* Database Abstraction Layer
* @package dbal
*/
-class phpbb_db_driver
+class driver
{
var $db_connect_id;
var $query_result;
@@ -82,7 +76,7 @@ class phpbb_db_driver
// Fill default sql layer based on the class being called.
// This can be changed by the specified layer itself later if needed.
- $this->sql_layer = substr(get_class($this), strlen('phpbb_db_driver_'));
+ $this->sql_layer = substr(get_class($this), strlen('phpbb\db\driver\\'));
// Do not change this please! This variable is used to easy the use of it - and is hardcoded.
$this->any_char = chr(0) . '%';
diff --git a/phpBB/phpbb/db/driver/firebird.php b/phpBB/phpbb/db/driver/firebird.php
index 787c28b812..ed56a5d154 100644
--- a/phpBB/phpbb/db/driver/firebird.php
+++ b/phpBB/phpbb/db/driver/firebird.php
@@ -7,20 +7,14 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* Firebird/Interbase Database Abstraction Layer
* Minimum Requirement is Firebird 2.1
* @package dbal
*/
-class phpbb_db_driver_firebird extends phpbb_db_driver
+class firebird extends \phpbb\db\driver\driver
{
var $last_query_text = '';
var $service_handle = false;
@@ -396,7 +390,7 @@ class phpbb_db_driver_firebird extends phpbb_db_driver
$query_id = $this->query_result;
}
- if ($cache && $cache->sql_exists($query_id))
+ if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
diff --git a/phpBB/phpbb/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php
index 89c2c2351b..6ebc891673 100644
--- a/phpBB/phpbb/db/driver/mssql.php
+++ b/phpBB/phpbb/db/driver/mssql.php
@@ -7,20 +7,14 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* MSSQL Database Abstraction Layer
* Minimum Requirement is MSSQL 2000+
* @package dbal
*/
-class phpbb_db_driver_mssql extends phpbb_db_driver
+class mssql extends \phpbb\db\driver\driver
{
var $connect_error = '';
@@ -257,7 +251,7 @@ class phpbb_db_driver_mssql extends phpbb_db_driver
{
foreach ($row as $key => $value)
{
- $row[$key] = ($value === ' ' || $value === NULL) ? '' : $value;
+ $row[$key] = ($value === ' ' || $value === null) ? '' : $value;
}
}
@@ -316,14 +310,14 @@ class phpbb_db_driver_mssql extends phpbb_db_driver
$query_id = $this->query_result;
}
- if ($cache && $cache->sql_exists($query_id))
+ if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
- if (isset($this->open_queries[$query_id]))
+ if (isset($this->open_queries[(int) $query_id]))
{
- unset($this->open_queries[$query_id]);
+ unset($this->open_queries[(int) $query_id]);
return @mssql_free_result($query_id);
}
diff --git a/phpBB/phpbb/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php
index 56c111c871..113f1c6902 100644
--- a/phpBB/phpbb/db/driver/mssql_base.php
+++ b/phpBB/phpbb/db/driver/mssql_base.php
@@ -7,19 +7,13 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* MSSQL Database Base Abstraction Layer
* @package dbal
*/
-abstract class phpbb_db_driver_mssql_base extends phpbb_db_driver
+abstract class mssql_base extends \phpbb\db\driver\driver
{
/**
* {@inheritDoc}
diff --git a/phpBB/phpbb/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php
index a1d1a5d5dd..f8c70f1cd7 100644
--- a/phpBB/phpbb/db/driver/mssql_odbc.php
+++ b/phpBB/phpbb/db/driver/mssql_odbc.php
@@ -7,13 +7,7 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* Unified ODBC functions
@@ -26,7 +20,7 @@ if (!defined('IN_PHPBB'))
*
* @package dbal
*/
-class phpbb_db_driver_mssql_odbc extends phpbb_db_driver_mssql_base
+class mssql_odbc extends \phpbb\db\driver\mssql_base
{
var $last_query_text = '';
var $connect_error = '';
@@ -303,7 +297,7 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver_mssql_base
$query_id = $this->query_result;
}
- if ($cache && $cache->sql_exists($query_id))
+ if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php
index 28fc88298a..125db9c8d4 100644
--- a/phpBB/phpbb/db/driver/mssqlnative.php
+++ b/phpBB/phpbb/db/driver/mssqlnative.php
@@ -11,189 +11,14 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
- * Prior to version 1.1 the SQL Server Native PHP driver didn't support sqlsrv_num_rows, or cursor based seeking so we recall all rows into an array
- * and maintain our own cursor index into that array.
- */
-class result_mssqlnative
-{
- public function result_mssqlnative($queryresult = false)
- {
- $this->m_cursor = 0;
- $this->m_rows = array();
- $this->m_num_fields = sqlsrv_num_fields($queryresult);
- $this->m_field_meta = sqlsrv_field_metadata($queryresult);
-
- while ($row = sqlsrv_fetch_array($queryresult, SQLSRV_FETCH_ASSOC))
- {
- if ($row !== null)
- {
- foreach($row as $k => $v)
- {
- if (is_object($v) && method_exists($v, 'format'))
- {
- $row[$k] = $v->format("Y-m-d\TH:i:s\Z");
- }
- }
- $this->m_rows[] = $row;//read results into memory, cursors are not supported
- }
- }
-
- $this->m_row_count = sizeof($this->m_rows);
- }
-
- private function array_to_obj($array, &$obj)
- {
- foreach ($array as $key => $value)
- {
- if (is_array($value))
- {
- $obj->$key = new stdClass();
- array_to_obj($value, $obj->$key);
- }
- else
- {
- $obj->$key = $value;
- }
- }
- return $obj;
- }
-
- public function fetch($mode = SQLSRV_FETCH_BOTH, $object_class = 'stdClass')
- {
- if ($this->m_cursor >= $this->m_row_count || $this->m_row_count == 0)
- {
- return false;
- }
-
- $ret = false;
- $arr_num = array();
-
- if ($mode == SQLSRV_FETCH_NUMERIC || $mode == SQLSRV_FETCH_BOTH)
- {
- foreach($this->m_rows[$this->m_cursor] as $key => $value)
- {
- $arr_num[] = $value;
- }
- }
-
- switch ($mode)
- {
- case SQLSRV_FETCH_ASSOC:
- $ret = $this->m_rows[$this->m_cursor];
- break;
- case SQLSRV_FETCH_NUMERIC:
- $ret = $arr_num;
- break;
- case 'OBJECT':
- $ret = $this->array_to_obj($this->m_rows[$this->m_cursor], $o = new $object_class);
- break;
- case SQLSRV_FETCH_BOTH:
- default:
- $ret = $this->m_rows[$this->m_cursor] + $arr_num;
- break;
- }
- $this->m_cursor++;
- return $ret;
- }
-
- public function get($pos, $fld)
- {
- return $this->m_rows[$pos][$fld];
- }
-
- public function num_rows()
- {
- return $this->m_row_count;
- }
-
- public function seek($iRow)
- {
- $this->m_cursor = min($iRow, $this->m_row_count);
- }
-
- public function num_fields()
- {
- return $this->m_num_fields;
- }
-
- public function field_name($nr)
- {
- $arr_keys = array_keys($this->m_rows[0]);
- return $arr_keys[$nr];
- }
-
- public function field_type($nr)
- {
- $i = 0;
- $int_type = -1;
- $str_type = '';
-
- foreach ($this->m_field_meta as $meta)
- {
- if ($nr == $i)
- {
- $int_type = $meta['Type'];
- break;
- }
- $i++;
- }
-
- //http://msdn.microsoft.com/en-us/library/cc296183.aspx contains type table
- switch ($int_type)
- {
- case SQLSRV_SQLTYPE_BIGINT: $str_type = 'bigint'; break;
- case SQLSRV_SQLTYPE_BINARY: $str_type = 'binary'; break;
- case SQLSRV_SQLTYPE_BIT: $str_type = 'bit'; break;
- case SQLSRV_SQLTYPE_CHAR: $str_type = 'char'; break;
- case SQLSRV_SQLTYPE_DATETIME: $str_type = 'datetime'; break;
- case SQLSRV_SQLTYPE_DECIMAL/*($precision, $scale)*/: $str_type = 'decimal'; break;
- case SQLSRV_SQLTYPE_FLOAT: $str_type = 'float'; break;
- case SQLSRV_SQLTYPE_IMAGE: $str_type = 'image'; break;
- case SQLSRV_SQLTYPE_INT: $str_type = 'int'; break;
- case SQLSRV_SQLTYPE_MONEY: $str_type = 'money'; break;
- case SQLSRV_SQLTYPE_NCHAR/*($charCount)*/: $str_type = 'nchar'; break;
- case SQLSRV_SQLTYPE_NUMERIC/*($precision, $scale)*/: $str_type = 'numeric'; break;
- case SQLSRV_SQLTYPE_NVARCHAR/*($charCount)*/: $str_type = 'nvarchar'; break;
- case SQLSRV_SQLTYPE_NTEXT: $str_type = 'ntext'; break;
- case SQLSRV_SQLTYPE_REAL: $str_type = 'real'; break;
- case SQLSRV_SQLTYPE_SMALLDATETIME: $str_type = 'smalldatetime'; break;
- case SQLSRV_SQLTYPE_SMALLINT: $str_type = 'smallint'; break;
- case SQLSRV_SQLTYPE_SMALLMONEY: $str_type = 'smallmoney'; break;
- case SQLSRV_SQLTYPE_TEXT: $str_type = 'text'; break;
- case SQLSRV_SQLTYPE_TIMESTAMP: $str_type = 'timestamp'; break;
- case SQLSRV_SQLTYPE_TINYINT: $str_type = 'tinyint'; break;
- case SQLSRV_SQLTYPE_UNIQUEIDENTIFIER: $str_type = 'uniqueidentifier'; break;
- case SQLSRV_SQLTYPE_UDT: $str_type = 'UDT'; break;
- case SQLSRV_SQLTYPE_VARBINARY/*($byteCount)*/: $str_type = 'varbinary'; break;
- case SQLSRV_SQLTYPE_VARCHAR/*($charCount)*/: $str_type = 'varchar'; break;
- case SQLSRV_SQLTYPE_XML: $str_type = 'xml'; break;
- default: $str_type = $int_type;
- }
- return $str_type;
- }
-
- public function free()
- {
- unset($this->m_rows);
- return;
- }
-}
+namespace phpbb\db\driver;
/**
* @package dbal
*/
-class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
+class mssqlnative extends \phpbb\db\driver\mssql_base
{
- var $m_insert_id = NULL;
+ var $m_insert_id = null;
var $last_query_text = '';
var $query_options = array();
var $connect_error = '';
@@ -425,7 +250,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
{
foreach ($row as $key => $value)
{
- $row[$key] = ($value === ' ' || $value === NULL) ? '' : $value;
+ $row[$key] = ($value === ' ' || $value === null) ? '' : $value;
}
// remove helper values from LIMIT queries
@@ -469,7 +294,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
$query_id = $this->query_result;
}
- if ($cache->sql_exists($query_id))
+ if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
@@ -479,6 +304,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
unset($this->open_queries[(int) $query_id]);
return @sqlsrv_free_stmt($query_id);
}
+
return false;
}
diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php
index f3744ac09d..e311f0dd74 100644
--- a/phpBB/phpbb/db/driver/mysql.php
+++ b/phpBB/phpbb/db/driver/mysql.php
@@ -7,13 +7,7 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* MySQL4 Database Abstraction Layer
@@ -24,7 +18,7 @@ if (!defined('IN_PHPBB'))
* MySQL 5.0+
* @package dbal
*/
-class phpbb_db_driver_mysql extends phpbb_db_driver_mysql_base
+class mysql extends \phpbb\db\driver\mysql_base
{
var $multi_insert = true;
var $connect_error = '';
@@ -287,7 +281,7 @@ class phpbb_db_driver_mysql extends phpbb_db_driver_mysql_base
$query_id = $this->query_result;
}
- if ($cache && $cache->sql_exists($query_id))
+ if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
diff --git a/phpBB/phpbb/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php
index ba44ea61aa..87b6d153a9 100644
--- a/phpBB/phpbb/db/driver/mysql_base.php
+++ b/phpBB/phpbb/db/driver/mysql_base.php
@@ -7,19 +7,13 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* Abstract MySQL Database Base Abstraction Layer
* @package dbal
*/
-abstract class phpbb_db_driver_mysql_base extends phpbb_db_driver
+abstract class mysql_base extends \phpbb\db\driver\driver
{
/**
* {@inheritDoc}
diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php
index 0f7a73ee6e..adc8f96302 100644
--- a/phpBB/phpbb/db/driver/mysqli.php
+++ b/phpBB/phpbb/db/driver/mysqli.php
@@ -7,13 +7,7 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* MySQLi Database Abstraction Layer
@@ -21,7 +15,7 @@ if (!defined('IN_PHPBB'))
* MySQL 4.1+ or MySQL 5.0+
* @package dbal
*/
-class phpbb_db_driver_mysqli extends phpbb_db_driver_mysql_base
+class mysqli extends \phpbb\db\driver\mysql_base
{
var $multi_insert = true;
var $connect_error = '';
@@ -29,7 +23,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver_mysql_base
/**
* Connect to server
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
if (!function_exists('mysqli_connect'))
{
@@ -45,11 +39,11 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver_mysql_base
$this->server = ($this->persistency) ? 'p:' . (($sqlserver) ? $sqlserver : 'localhost') : $sqlserver;
$this->dbname = $database;
- $port = (!$port) ? NULL : $port;
+ $port = (!$port) ? null : $port;
// If port is set and it is not numeric, most likely mysqli socket is set.
// Try to map it to the $socket parameter.
- $socket = NULL;
+ $socket = null;
if ($port)
{
if (is_numeric($port))
@@ -59,7 +53,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver_mysql_base
else
{
$socket = $port;
- $port = NULL;
+ $port = null;
}
}
diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php
index e21e07055d..36ed43d4a7 100644
--- a/phpBB/phpbb/db/driver/oracle.php
+++ b/phpBB/phpbb/db/driver/oracle.php
@@ -7,19 +7,13 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* Oracle Database Abstraction Layer
* @package dbal
*/
-class phpbb_db_driver_oracle extends phpbb_db_driver
+class oracle extends \phpbb\db\driver\driver
{
var $last_query_text = '';
var $connect_error = '';
@@ -619,7 +613,7 @@ class phpbb_db_driver_oracle extends phpbb_db_driver
$query_id = $this->query_result;
}
- if ($cache && $cache->sql_exists($query_id))
+ if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php
index 14854d179d..5dbd1ca74f 100644
--- a/phpBB/phpbb/db/driver/postgres.php
+++ b/phpBB/phpbb/db/driver/postgres.php
@@ -7,20 +7,14 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* PostgreSQL Database Abstraction Layer
* Minimum Requirement is Version 7.3+
* @package dbal
*/
-class phpbb_db_driver_postgres extends phpbb_db_driver
+class postgres extends \phpbb\db\driver\driver
{
var $last_query_text = '';
var $connect_error = '';
@@ -84,7 +78,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
$this->connect_error = 'pg_pconnect function does not exist, is pgsql extension installed?';
return $this->sql_error('');
}
- $collector = new phpbb_error_collector;
+ $collector = new \phpbb\error_collector;
$collector->install();
$this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
@@ -95,7 +89,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
$this->connect_error = 'pg_connect function does not exist, is pgsql extension installed?';
return $this->sql_error('');
}
- $collector = new phpbb_error_collector;
+ $collector = new \phpbb\error_collector;
$collector->install();
$this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
@@ -326,7 +320,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
return false;
}
- $temp_result = @pg_fetch_assoc($temp_q_id, NULL);
+ $temp_result = @pg_fetch_assoc($temp_q_id, null);
@pg_free_result($query_id);
return ($temp_result) ? $temp_result['last_value'] : false;
@@ -348,7 +342,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
$query_id = $this->query_result;
}
- if ($cache && $cache->sql_exists($query_id))
+ if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
@@ -454,7 +448,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query"))
{
- while ($row = @pg_fetch_assoc($result, NULL))
+ while ($row = @pg_fetch_assoc($result, null))
{
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
@@ -474,7 +468,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
$endtime = $endtime[0] + $endtime[1];
$result = @pg_query($this->db_connect_id, $query);
- while ($void = @pg_fetch_assoc($result, NULL))
+ while ($void = @pg_fetch_assoc($result, null))
{
// Take the time spent on parsing rows into account
}
diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php
index 7188f0daa2..59ec895c0f 100644
--- a/phpBB/phpbb/db/driver/sqlite.php
+++ b/phpBB/phpbb/db/driver/sqlite.php
@@ -7,20 +7,14 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\driver;
/**
* Sqlite Database Abstraction Layer
* Minimum Requirement: 2.8.2+
* @package dbal
*/
-class phpbb_db_driver_sqlite extends phpbb_db_driver
+class sqlite extends \phpbb\db\driver\driver
{
var $connect_error = '';
@@ -259,7 +253,7 @@ class phpbb_db_driver_sqlite extends phpbb_db_driver
$query_id = $this->query_result;
}
- if ($cache && $cache->sql_exists($query_id))
+ if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{
return $cache->sql_freeresult($query_id);
}
diff --git a/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
index f324b8880d..5e6ba90336 100644
--- a/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php
+++ b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
@@ -7,11 +7,13 @@
*
*/
-class phpbb_db_migration_data_30x_local_url_bbcode extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class local_url_bbcode extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_12_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc1');
}
public function update_data()
@@ -44,7 +46,7 @@ class phpbb_db_migration_data_30x_local_url_bbcode extends phpbb_db_migration
$bbcode_match = $row['bbcode_match'];
$bbcode_tpl = $row['bbcode_tpl'];
- $acp_bbcodes = new acp_bbcodes();
+ $acp_bbcodes = new \acp_bbcodes();
$sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl);
$sql = 'UPDATE ' . BBCODES_TABLE . '
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php
index c996a0138a..aed0f2784b 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_1_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_1_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php
index 122f93d6b4..305309c3bd 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_10.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_10 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_10 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.10', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.10', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_10_rc3');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc3');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php
index 459b423736..fb50d67fb5 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_10_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.10-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.10-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php
index 8d21cab45d..63ba1e8fc2 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_10_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.10-RC2', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.10-RC2', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_10_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php
index 296c3c40af..7055063032 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_10_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.10-RC3', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.10-RC3', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_10_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php
index e063c699cc..1246597efb 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_11.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_11 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_11 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.11', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.11', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php
index 3a3908258f..7e284235e1 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_11_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.11-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.11-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_10');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_10');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php
index 4b1b5642ce..017038855d 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_11_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.11-RC2', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.11-RC2', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11_rc1');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php
new file mode 100644
index 0000000000..5a2d569724
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php
@@ -0,0 +1,33 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_12 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return phpbb_version_compare($this->config['version'], '3.0.12', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc3');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ phpbb_version_compare($this->config['version'], '3.0.12', '<'),
+ array('config.update', array('version', '3.0.12')),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php
index 1338d48006..35a3015959 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php
@@ -7,18 +7,20 @@
*
*/
+namespace phpbb\db\migration\data\v30x;
+
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 **/
-class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration
+class release_3_0_12_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.12-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.12-RC1', '>=');
}
- static public function depends_on()
+ static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php
new file mode 100644
index 0000000000..3edb578fc8
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php
@@ -0,0 +1,33 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_12_rc2 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return phpbb_version_compare($this->config['version'], '3.0.12-RC2', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc1');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ phpbb_version_compare($this->config['version'], '3.0.12-RC2', '<'),
+ array('config.update', array('version', '3.0.12-RC2')),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php
new file mode 100644
index 0000000000..510693a5b7
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php
@@ -0,0 +1,33 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_12_rc3 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return phpbb_version_compare($this->config['version'], '3.0.12-RC3', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc2');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ phpbb_version_compare($this->config['version'], '3.0.12-RC3', '<'),
+ array('config.update', array('version', '3.0.12-RC3')),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php
index 761ed5d2ec..862276528d 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php
@@ -7,11 +7,13 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_1_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_1_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.1-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.1-RC1', '>=');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php
index eed5acef82..7e2a08590e 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.2', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.2', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_2_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_2_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php
index a84f3c2d92..7a856383e2 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_2_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.2-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.2-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php
index 33bacc077f..61562575eb 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_2_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.2-RC2', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.2-RC2', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_2_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_2_rc1');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php
index 8984cf7b76..b2adbeaa43 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_3.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_3 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.3', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.3', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_3_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_3_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php
index 69433f386e..57bd59bba3 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_3_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.3-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.3-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_2');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php
index 9a0c132e78..5d6140393b 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_4.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_4 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.4', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.4', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_4_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_4_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
index e45bd3eeee..a8af4dd76c 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_4_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.4-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.4-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_3');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_3');
}
public function update_schema()
@@ -82,7 +84,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration
public function update_custom_profile_fields()
{
- // Update the Custom Profile Fields based on previous settings to the new format
+ // Update the Custom Profile Fields based on previous settings to the new \format
$sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide
FROM ' . PROFILE_FIELDS_TABLE;
$result = $this->db->sql_query($sql);
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php
index 16d2dee457..7bbe7ffed9 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_5.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_5 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_5 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.5', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.5', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_5_rc1part2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_5_rc1part2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php
index 62ae7bff1a..ffe2c6a44d 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_5_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_5_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.5-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_4');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_4');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php
index d72176489b..04b14b5189 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_5_rc1part2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.5-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_5_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_5_rc1');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php
index bb651dc7cd..85ea2e9d20 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.6', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.6', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6_rc4');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc4');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php
index 25f4995b0e..87d5e490f8 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.6-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.6-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_5');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_5');
}
public function update_schema()
@@ -318,7 +320,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration
// Clear permissions...
include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext);
- $auth_admin = new auth_admin();
+ $auth_admin = new \auth_admin();
$auth_admin->acl_clear_prefetch();
}
}
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php
index d5d14ab05d..7a0ef28601 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.6-RC2', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.6-RC2', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php
index f3f1fb42f4..73a1fe9e6a 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.6-RC3', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.6-RC3', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc2');
}
public function update_data()
@@ -30,7 +32,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration
public function update_cp_fields()
{
- // Update the Custom Profile Fields based on previous settings to the new format
+ // Update the Custom Profile Fields based on previous settings to the new \format
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . '
SET field_show_on_vt = 1
WHERE field_hide = 0
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php
index 6138ef351d..b6e5be2c2f 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6_rc4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.6-RC4', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.6-RC4', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6_rc3');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc3');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php
index 9ff2e9e4ab..2b0da30bc6 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_7.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_7 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_7 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.7', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.7', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_7_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_7_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php
index c9cc9d19ac..3547ee77e1 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_7_pl1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_7_pl1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.7-pl1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.7-pl1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_7');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_7');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php
index be8f9045f4..de4d772808 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_7_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.7-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.7-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php
index 0e43229f13..800803a753 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_7_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.7-RC2', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.7-RC2', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_7_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_7_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php
index 8998ef9627..6c8b1df6fc 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_8.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_8 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_8 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.8', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.8', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_8_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_8_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php
index ff7824fa3b..1a14e5c961 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_8_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.8-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.8-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_7_pl1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_7_pl1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php
index d5269ea6f0..9af2fce971 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.9', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.9', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9_rc4');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc4');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php
index d3beda63b7..3fb790bc0d 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.9-RC1', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.9-RC1', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_8');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_8');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php
index beb8873da7..cd79d24ade 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.9-RC2', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.9-RC2', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php
index 56e04e7235..7e59b8f9e8 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.9-RC3', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.9-RC3', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php
index 5be1124287..e71d9defa6 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php
@@ -7,16 +7,18 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9_rc4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return version_compare($this->config['version'], '3.0.9-RC4', '>=');
+ return phpbb_version_compare($this->config['version'], '3.0.9-RC4', '>=');
}
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9_rc3');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc3');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php b/phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php
new file mode 100644
index 0000000000..9f168f4fd6
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php
@@ -0,0 +1,42 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class acp_style_components_module extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ $sql = 'SELECT module_id
+ FROM ' . MODULES_TABLE . "
+ WHERE module_class = 'acp'
+ AND module_langname = 'ACP_STYLE_COMPONENTS'";
+ $result = $this->db->sql_query($sql);
+ $module_id = $this->db->sql_fetchfield('module_id');
+ $this->db->sql_freeresult($result);
+
+ return $module_id == false;
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\dev');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('module.remove', array(
+ 'acp',
+ false,
+ 'ACP_STYLE_COMPONENTS',
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/allow_cdn.php b/phpBB/phpbb/db/migration/data/v310/allow_cdn.php
new file mode 100644
index 0000000000..aa471df6e7
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/allow_cdn.php
@@ -0,0 +1,33 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class allow_cdn extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return isset($this->config['allow_cdn']);
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\jquery_update',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('allow_cdn', (int) $this->config['load_jquery_cdn'])),
+ array('config.remove', array('load_jquery_cdn')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/alpha1.php b/phpBB/phpbb/db/migration/data/v310/alpha1.php
new file mode 100644
index 0000000000..403e301e64
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/alpha1.php
@@ -0,0 +1,44 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class alpha1 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v30x\local_url_bbcode',
+ '\phpbb\db\migration\data\v30x\release_3_0_12',
+ '\phpbb\db\migration\data\v310\acp_style_components_module',
+ '\phpbb\db\migration\data\v310\allow_cdn',
+ '\phpbb\db\migration\data\v310\auth_provider_oauth',
+ '\phpbb\db\migration\data\v310\avatars',
+ '\phpbb\db\migration\data\v310\boardindex',
+ '\phpbb\db\migration\data\v310\config_db_text',
+ '\phpbb\db\migration\data\v310\forgot_password',
+ '\phpbb\db\migration\data\v310\mod_rewrite',
+ '\phpbb\db\migration\data\v310\mysql_fulltext_drop',
+ '\phpbb\db\migration\data\v310\namespaces',
+ '\phpbb\db\migration\data\v310\notifications_cron',
+ '\phpbb\db\migration\data\v310\notification_options_reconvert',
+ '\phpbb\db\migration\data\v310\plupload',
+ '\phpbb\db\migration\data\v310\signature_module_auth',
+ '\phpbb\db\migration\data\v310\softdelete_mcp_modules',
+ '\phpbb\db\migration\data\v310\teampage',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.0-a1')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php
new file mode 100644
index 0000000000..971a7e8504
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php
@@ -0,0 +1,73 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class auth_provider_oauth extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return $this->db_tools->sql_table_exists($this->table_prefix . 'auth_provider_oauth');
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'add_tables' => array(
+ $this->table_prefix . 'oauth_tokens' => array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0), // phpbb_users.user_id
+ 'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set
+ 'provider' => array('VCHAR', ''), // Name of the OAuth provider
+ 'oauth_token' => array('MTEXT', ''), // Serialized token
+ ),
+ 'KEYS' => array(
+ 'user_id' => array('INDEX', 'user_id'),
+ 'provider' => array('INDEX', 'provider'),
+ ),
+ ),
+ $this->table_prefix . 'oauth_accounts' => array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'provider' => array('VCHAR', ''),
+ 'oauth_provider_id' => array('TEXT_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => array(
+ 'user_id',
+ 'provider',
+ ),
+ ),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'drop_tables' => array(
+ $this->table_prefix . 'oauth_tokens',
+ $this->table_prefix . 'oauth_accounts',
+ ),
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('module.add', array(
+ 'ucp',
+ 'UCP_PROFILE',
+ array(
+ 'module_basename' => 'ucp_auth_link',
+ 'modes' => array('auth_link'),
+ ),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/avatars.php b/phpBB/phpbb/db/migration/data/v310/avatars.php
index 79547337f7..80ce606f29 100644
--- a/phpBB/phpbb/db/migration/data/310/avatars.php
+++ b/phpBB/phpbb/db/migration/data/v310/avatars.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_avatars extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class avatars extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_avatars extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/boardindex.php b/phpBB/phpbb/db/migration/data/v310/boardindex.php
index 965e32c15c..27492f2d0d 100644
--- a/phpBB/phpbb/db/migration/data/310/boardindex.php
+++ b/phpBB/phpbb/db/migration/data/v310/boardindex.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_boardindex extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class boardindex extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
diff --git a/phpBB/phpbb/db/migration/data/310/config_db_text.php b/phpBB/phpbb/db/migration/data/v310/config_db_text.php
index 89f211adda..1a7ee7a9a6 100644
--- a/phpBB/phpbb/db/migration/data/310/config_db_text.php
+++ b/phpBB/phpbb/db/migration/data/v310/config_db_text.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_config_db_text extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class config_db_text extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_config_db_text extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/dev.php b/phpBB/phpbb/db/migration/data/v310/dev.php
index 0fc2950987..c1db883616 100644
--- a/phpBB/phpbb/db/migration/data/310/dev.php
+++ b/phpBB/phpbb/db/migration/data/v310/dev.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_dev extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class dev extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -17,10 +19,10 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration
static public function depends_on()
{
return array(
- 'phpbb_db_migration_data_310_extensions',
- 'phpbb_db_migration_data_310_style_update_p2',
- 'phpbb_db_migration_data_310_timezone_p2',
- 'phpbb_db_migration_data_310_reported_posts_display',
+ '\phpbb\db\migration\data\v310\extensions',
+ '\phpbb\db\migration\data\v310\style_update_p2',
+ '\phpbb\db\migration\data\v310\timezone_p2',
+ '\phpbb\db\migration\data\v310\reported_posts_display',
);
}
@@ -206,7 +208,7 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration
{
include($this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext);
}
- $module_manager = new acp_modules();
+ $module_manager = new \acp_modules();
$module_manager->module_class = 'acp';
$module_manager->move_module($language_module_id, $language_management_module_id);
}
diff --git a/phpBB/phpbb/db/migration/data/310/extensions.php b/phpBB/phpbb/db/migration/data/v310/extensions.php
index 6a9caa1cfc..d8b38dbc9e 100644
--- a/phpBB/phpbb/db/migration/data/310/extensions.php
+++ b/phpBB/phpbb/db/migration/data/v310/extensions.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_extensions extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class extensions extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_extensions extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/forgot_password.php b/phpBB/phpbb/db/migration/data/v310/forgot_password.php
index a553e51f35..814093caa9 100644
--- a/phpBB/phpbb/db/migration/data/310/forgot_password.php
+++ b/phpBB/phpbb/db/migration/data/v310/forgot_password.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_forgot_password extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class forgot_password extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_forgot_password extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/310/jquery_update.php b/phpBB/phpbb/db/migration/data/v310/jquery_update.php
index dc49f74fcb..bd2de2b4d4 100644
--- a/phpBB/phpbb/db/migration/data/310/jquery_update.php
+++ b/phpBB/phpbb/db/migration/data/v310/jquery_update.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_jquery_update extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class jquery_update extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -17,7 +19,7 @@ class phpbb_db_migration_data_310_jquery_update extends phpbb_db_migration
static public function depends_on()
{
return array(
- 'phpbb_db_migration_data_310_dev',
+ '\phpbb\db\migration\data\v310\dev',
);
}
diff --git a/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php b/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php
new file mode 100644
index 0000000000..ffb790b135
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php
@@ -0,0 +1,27 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class mod_rewrite extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\dev',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('enable_mod_rewrite', '0')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php
new file mode 100644
index 0000000000..97d174d4bc
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php
@@ -0,0 +1,47 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class mysql_fulltext_drop extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ // This migration is irrelevant for all non-MySQL DBMSes.
+ return strpos($this->db->sql_layer, 'mysql') === false;
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\dev',
+ );
+ }
+
+ public function update_schema()
+ {
+ /*
+ * Drop FULLTEXT indexes related to MySQL fulltext search.
+ * Doing so is equivalent to dropping the search index from the ACP.
+ * Possibly time-consuming recreation of the search index (i.e.
+ * FULLTEXT indexes) is left as a task to the admin to not
+ * unnecessarily stall the upgrade process. The new search index will
+ * then require about 40% less table space (also see PHPBB3-11621).
+ */
+ return array(
+ 'drop_keys' => array(
+ $this->table_prefix . 'posts' => array(
+ 'post_subject',
+ 'post_text',
+ 'post_content',
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/namespaces.php b/phpBB/phpbb/db/migration/data/v310/namespaces.php
new file mode 100644
index 0000000000..f74ecbd874
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/namespaces.php
@@ -0,0 +1,30 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class namespaces extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\dev',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ (preg_match('#^phpbb_search_#', $this->config['search_type'])),
+ array('config.update', array('search_type', str_replace('phpbb_search_', '\\phpbb\\search\\', $this->config['search_type']))),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
index d994d7ec5f..4195623618 100644
--- a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php
+++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
@@ -7,45 +7,56 @@
*
*/
-class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class notification_options_reconvert extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_notifications_schema_fix');
+ return array('\phpbb\db\migration\data\v310\notifications_schema_fix');
}
public function update_data()
{
return array(
+ array('custom', array(array($this, 'purge_notifications'))),
array('custom', array(array($this, 'convert_notifications'))),
);
}
- public function convert_notifications()
+ public function purge_notifications()
+ {
+ $sql = 'DELETE FROM ' . $this->table_prefix . 'user_notifications';
+ $this->sql_query($sql);
+ }
+
+ public function convert_notifications($start)
{
- $insert_table = $this->table_prefix . 'user_notifications';
- $insert_buffer = new phpbb_db_sql_insert_buffer($this->db, $insert_table);
+ $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->table_prefix . 'user_notifications');
- $this->perform_conversion($insert_buffer, $insert_table);
+ return $this->perform_conversion($insert_buffer, $start);
}
/**
* Perform the conversion (separate for testability)
*
- * @param phpbb_db_sql_insert_buffer $insert_buffer
- * @param string $insert_table
+ * @param \phpbb\db\sql_insert_buffer $insert_buffer
+ * @param int $start Start of staggering step
+ * @return mixed int start of the next step, null if the end was reached
*/
- public function perform_conversion(phpbb_db_sql_insert_buffer $insert_buffer, $insert_table)
+ public function perform_conversion(\phpbb\db\sql_insert_buffer $insert_buffer, $start)
{
- $sql = 'DELETE FROM ' . $insert_table;
- $this->db->sql_query($sql);
+ $limit = 250;
+ $converted_users = 0;
$sql = 'SELECT user_id, user_notify_type, user_notify_pm
- FROM ' . USERS_TABLE;
- $result = $this->db->sql_query($sql);
+ FROM ' . $this->table_prefix . 'users
+ ORDER BY user_id';
+ $result = $this->db->sql_query_limit($sql, $limit, $start);
while ($row = $this->db->sql_fetchrow($result))
{
+ $converted_users++;
$notification_methods = array();
// In-board notification
@@ -89,18 +100,26 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d
$this->db->sql_freeresult($result);
$insert_buffer->flush();
+
+ if ($converted_users < $limit)
+ {
+ // No more users left, we are done...
+ return;
+ }
+
+ return $start + $limit;
}
/**
* Insert method rows to DB
*
- * @param phpbb_db_sql_insert_buffer $insert_buffer
+ * @param \phpbb\db\sql_insert_buffer $insert_buffer
* @param string $item_type
* @param int $item_id
* @param int $user_id
* @param string $methods
*/
- protected function add_method_rows(phpbb_db_sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods)
+ protected function add_method_rows(\phpbb\db\sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods)
{
$row_base = array(
'item_type' => $item_type,
diff --git a/phpBB/phpbb/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/v310/notifications.php
index 17c939d95a..61be25bb5f 100644
--- a/phpBB/phpbb/db/migration/data/310/notifications.php
+++ b/phpBB/phpbb/db/migration/data/v310/notifications.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_notifications extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class notifications extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_notifications extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_dev');
+ return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
@@ -32,7 +34,7 @@ class phpbb_db_migration_data_310_notifications extends phpbb_db_migration
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
- 'notification_id' => array('UINT', NULL, 'auto_increment'),
+ 'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_cron.php b/phpBB/phpbb/db/migration/data/v310/notifications_cron.php
new file mode 100644
index 0000000000..d5fa9c58a5
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/notifications_cron.php
@@ -0,0 +1,27 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class notifications_cron extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\notifications');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('read_notification_expire_days', 30)),
+ array('config.add', array('read_notification_last_gc', 0)), // last run
+ array('config.add', array('read_notification_gc', (60 * 60 * 24))), // seconds between run; 1 day
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php
index 27e63e10d0..eb2eb361ee 100644
--- a/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php
+++ b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php
@@ -7,11 +7,13 @@
*
*/
-class phpbb_db_migration_data_310_notifications_schema_fix extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class notifications_schema_fix extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_notifications');
+ return array('\phpbb\db\migration\data\v310\notifications');
}
public function update_schema()
@@ -24,7 +26,7 @@ class phpbb_db_migration_data_310_notifications_schema_fix extends phpbb_db_migr
'add_tables' => array(
$this->table_prefix . 'notification_types' => array(
'COLUMNS' => array(
- 'notification_type_id' => array('USINT', NULL, 'auto_increment'),
+ 'notification_type_id' => array('USINT', null, 'auto_increment'),
'notification_type_name' => array('VCHAR:255', ''),
'notification_type_enabled' => array('BOOL', 1),
),
@@ -35,7 +37,7 @@ class phpbb_db_migration_data_310_notifications_schema_fix extends phpbb_db_migr
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
- 'notification_id' => array('UINT:10', NULL, 'auto_increment'),
+ 'notification_id' => array('UINT:10', null, 'auto_increment'),
'notification_type_id' => array('USINT', 0),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
@@ -71,7 +73,7 @@ class phpbb_db_migration_data_310_notifications_schema_fix extends phpbb_db_migr
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
- 'notification_id' => array('UINT', NULL, 'auto_increment'),
+ 'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
diff --git a/phpBB/phpbb/db/migration/data/v310/plupload.php b/phpBB/phpbb/db/migration/data/v310/plupload.php
new file mode 100644
index 0000000000..7cdba507a2
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/plupload.php
@@ -0,0 +1,32 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class plupload extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return isset($this->config['plupload_last_gc']) &&
+ isset($this->config['plupload_salt']);
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\dev');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('plupload_last_gc', 0)),
+ array('config.add', array('plupload_salt', unique_id())),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php
index 80a0a0e43f..56b7a0916c 100644
--- a/phpBB/phpbb/db/migration/data/310/reported_posts_display.php
+++ b/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_reported_posts_display extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class reported_posts_display extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_reported_posts_display extends phpbb_db_migrat
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php
index 02cd70059a..6da1cb8009 100644
--- a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php
+++ b/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_signature_module_auth extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class signature_module_auth extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -25,7 +27,7 @@ class phpbb_db_migration_data_310_signature_module_auth extends phpbb_db_migrati
static public function depends_on()
{
- return array('phpbb_db_migration_data_31x_dev');
+ return array('\phpbb\db\migration\data\v310\dev');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php
new file mode 100644
index 0000000000..d1a31815b2
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php
@@ -0,0 +1,57 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class softdelete_mcp_modules extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ $sql = 'SELECT module_id
+ FROM ' . MODULES_TABLE . "
+ WHERE module_class = 'mcp'
+ AND module_basename = 'mcp_queue'
+ AND module_mode = 'deleted_topics'";
+ $result = $this->db->sql_query($sql);
+ $module_id = $this->db->sql_fetchfield('module_id');
+ $this->db->sql_freeresult($result);
+
+ return $module_id !== false;
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\dev',
+ '\phpbb\db\migration\data\v310\softdelete_p2',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('module.add', array(
+ 'mcp',
+ 'MCP_QUEUE',
+ array(
+ 'module_basename' => 'mcp_queue',
+ 'modes' => array('deleted_topics'),
+ ),
+ )),
+ array('module.add', array(
+ 'mcp',
+ 'MCP_QUEUE',
+ array(
+ 'module_basename' => 'mcp_queue',
+ 'modes' => array('deleted_posts'),
+ ),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php
index 84f8eebd4a..f080c78c50 100644
--- a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php
+++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class softdelete_p1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_dev');
+ return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
@@ -99,7 +101,8 @@ class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration
return array(
array('custom', array(array($this, 'update_post_visibility'))),
array('custom', array(array($this, 'update_topic_visibility'))),
- array('custom', array(array($this, 'update_topic_forum_counts'))),
+ array('custom', array(array($this, 'update_topics_post_counts'))),
+ array('custom', array(array($this, 'update_forums_topic_and_post_counts'))),
array('permission.add', array('f_softdelete', false)),
array('permission.add', array('m_softdelete', false)),
@@ -120,28 +123,43 @@ class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration
$this->sql_query($sql);
}
- public function update_topic_forum_counts()
+ public function update_topics_post_counts()
{
+ /*
+ * 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.
+ */
$sql = 'UPDATE ' . $this->table_prefix . 'topics
SET topic_posts_approved = topic_replies + 1,
- topic_posts_unapproved = topic_replies_real - topic_replies
+ topic_posts_unapproved = ' . $this->db->sql_case('topic_replies_real > topic_replies', 'topic_replies_real - topic_replies', '0') . '
WHERE topic_visibility = ' . ITEM_APPROVED;
$this->sql_query($sql);
$sql = 'UPDATE ' . $this->table_prefix . 'topics
SET topic_posts_approved = 0,
- topic_posts_unapproved = (topic_replies_real - topic_replies) + 1
+ topic_posts_unapproved = (' . $this->db->sql_case('topic_replies_real > topic_replies', 'topic_replies_real - topic_replies', '0') . ') + 1
WHERE topic_visibility = ' . ITEM_UNAPPROVED;
$this->sql_query($sql);
+ }
+
+ public function update_forums_topic_and_post_counts($start)
+ {
+ $start = (int) $start;
+ $limit = 10;
+ $converted_forums = 0;
$sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved
FROM ' . $this->table_prefix . 'topics
- GROUP BY forum_id, topic_visibility';
- $result = $this->db->sql_query($sql);
+ GROUP BY forum_id, topic_visibility
+ ORDER BY forum_id, topic_visibility';
+ $result = $this->db->sql_query_limit($sql, $limit, $start);
$update_forums = array();
while ($row = $this->db->sql_fetchrow($result))
{
+ $converted_forums++;
+
$forum_id = (int) $row['forum_id'];
if (!isset($update_forums[$forum_id]))
{
@@ -167,5 +185,14 @@ class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration
WHERE forum_id = ' . $forum_id;
$this->sql_query($sql);
}
+
+ if ($converted_forums < $limit)
+ {
+ // There are no more topics, we are done
+ return;
+ }
+
+ // There are still more topics to query, return the next start value
+ return $start + $limit;
}
}
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php
index 7320a2c2bf..0c32e474f4 100644
--- a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php
+++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_softdelete_p2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class softdelete_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -17,8 +19,8 @@ class phpbb_db_migration_data_310_softdelete_p2 extends phpbb_db_migration
static public function depends_on()
{
return array(
- 'phpbb_db_migration_data_310_dev',
- 'phpbb_db_migration_data_310_softdelete_p1',
+ '\phpbb\db\migration\data\v310\dev',
+ '\phpbb\db\migration\data\v310\softdelete_p1',
);
}
diff --git a/phpBB/phpbb/db/migration/data/310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
index d43537559d..26f1046287 100644
--- a/phpBB/phpbb/db/migration/data/310/style_update_p1.php
+++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_style_update_p1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class style_update_p1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_style_update_p1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
@@ -59,7 +61,7 @@ class phpbb_db_migration_data_310_style_update_p1 extends phpbb_db_migration
// Get list of valid 3.1 styles
$available_styles = array('prosilver');
- $iterator = new DirectoryIterator($this->phpbb_root_path . 'styles');
+ $iterator = new \DirectoryIterator($this->phpbb_root_path . 'styles');
$skip_dirs = array('.', '..', 'prosilver');
foreach ($iterator as $fileinfo)
{
diff --git a/phpBB/phpbb/db/migration/data/310/style_update_p2.php b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php
index 7b10518a66..c5b45d9dc9 100644
--- a/phpBB/phpbb/db/migration/data/310/style_update_p2.php
+++ b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class style_update_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_style_update_p1');
+ return array('\phpbb\db\migration\data\v310\style_update_p1');
}
public function update_schema()
@@ -54,7 +56,7 @@ class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration
'add_tables' => array(
$this->table_prefix . 'styles_imageset' => array(
'COLUMNS' => array(
- 'imageset_id' => array('UINT', NULL, 'auto_increment'),
+ 'imageset_id' => array('UINT', null, 'auto_increment'),
'imageset_name' => array('VCHAR_UNI:255', ''),
'imageset_copyright' => array('VCHAR_UNI', ''),
'imageset_path' => array('VCHAR:100', ''),
@@ -66,7 +68,7 @@ class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration
),
$this->table_prefix . 'styles_imageset_data' => array(
'COLUMNS' => array(
- 'image_id' => array('UINT', NULL, 'auto_increment'),
+ 'image_id' => array('UINT', null, 'auto_increment'),
'image_name' => array('VCHAR:200', ''),
'image_filename' => array('VCHAR:200', ''),
'image_lang' => array('VCHAR:30', ''),
@@ -81,7 +83,7 @@ class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration
),
$this->table_prefix . 'styles_template' => array(
'COLUMNS' => array(
- 'template_id' => array('UINT', NULL, 'auto_increment'),
+ 'template_id' => array('UINT', null, 'auto_increment'),
'template_name' => array('VCHAR_UNI:255', ''),
'template_copyright' => array('VCHAR_UNI', ''),
'template_path' => array('VCHAR:100', ''),
@@ -110,7 +112,7 @@ class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration
),
$this->table_prefix . 'styles_theme' => array(
'COLUMNS' => array(
- 'theme_id' => array('UINT', NULL, 'auto_increment'),
+ 'theme_id' => array('UINT', null, 'auto_increment'),
'theme_name' => array('VCHAR_UNI:255', ''),
'theme_copyright' => array('VCHAR_UNI', ''),
'theme_path' => array('VCHAR:100', ''),
diff --git a/phpBB/phpbb/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/v310/teampage.php
index 4e77da17b7..172435c672 100644
--- a/phpBB/phpbb/db/migration/data/310/teampage.php
+++ b/phpBB/phpbb/db/migration/data/v310/teampage.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_teampage extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class teampage extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_teampage extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_dev');
+ return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
@@ -25,7 +27,7 @@ class phpbb_db_migration_data_310_teampage extends phpbb_db_migration
'add_tables' => array(
$this->table_prefix . 'teampage' => array(
'COLUMNS' => array(
- 'teampage_id' => array('UINT', NULL, 'auto_increment'),
+ 'teampage_id' => array('UINT', null, 'auto_increment'),
'group_id' => array('UINT', 0),
'teampage_name' => array('VCHAR_UNI:255', ''),
'teampage_position' => array('UINT', 0),
diff --git a/phpBB/phpbb/db/migration/data/310/timezone.php b/phpBB/phpbb/db/migration/data/v310/timezone.php
index 6e50cbe45f..dd0c6a2093 100644
--- a/phpBB/phpbb/db/migration/data/310/timezone.php
+++ b/phpBB/phpbb/db/migration/data/v310/timezone.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_timezone extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class timezone extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_timezone extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/timezone_p2.php b/phpBB/phpbb/db/migration/data/v310/timezone_p2.php
index 113b979e4f..1066ab8571 100644
--- a/phpBB/phpbb/db/migration/data/310/timezone_p2.php
+++ b/phpBB/phpbb/db/migration/data/v310/timezone_p2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_timezone_p2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class timezone_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_timezone_p2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_timezone');
+ return array('\phpbb\db\migration\data\v310\timezone');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php
index e84330dd71..cfe546d1ab 100644
--- a/phpBB/phpbb/db/migration/exception.php
+++ b/phpBB/phpbb/db/migration/exception.php
@@ -7,20 +7,14 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\migration;
/**
* The migrator is responsible for applying new migrations in the correct order.
*
* @package db
*/
-class phpbb_db_migration_exception extends \Exception
+class exception extends \Exception
{
/**
* Extra parameters sent to exception to aid in debugging
@@ -64,12 +58,12 @@ class phpbb_db_migration_exception extends \Exception
}
/**
- * Get localised message (with $user->lang())
- *
- * @param phpbb_user $user
+ * Get localised message (with $user->lang())
+ *
+ * @param \phpbb\user $user
* @return string
*/
- public function getLocalisedMessage(phpbb_user $user)
+ public function getLocalisedMessage(\phpbb\user $user)
{
$parameters = $this->getParameters();
array_unshift($parameters, $this->getMessage());
diff --git a/phpBB/phpbb/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php
index 0ffa96fd14..b32de00871 100644
--- a/phpBB/phpbb/db/migration/migration.php
+++ b/phpBB/phpbb/db/migration/migration.php
@@ -7,13 +7,7 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db\migration;
/**
* Abstract base class for database migrations
@@ -24,15 +18,15 @@ if (!defined('IN_PHPBB'))
*
* @package db
*/
-abstract class phpbb_db_migration
+abstract class migration
{
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_db_tools */
+ /** @var \phpbb\db\tools */
protected $db_tools;
/** @var string */
@@ -53,14 +47,14 @@ abstract class phpbb_db_migration
/**
* Constructor
*
- * @param phpbb_config $config
- * @param phpbb_db_driver $db
- * @param phpbb_db_tools $db_tools
+ * @param \phpbb\config\config $config
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\db\tools $db_tools
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $table_prefix
*/
- public function __construct(phpbb_config $config, phpbb_db_driver $db, phpbb_db_tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
+ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
{
$this->config = $config;
$this->db = $db;
diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php
index 0b626bf455..f2149dc59a 100644
--- a/phpBB/phpbb/db/migration/tool/config.php
+++ b/phpBB/phpbb/db/migration/tool/config.php
@@ -7,22 +7,24 @@
*
*/
+namespace phpbb\db\migration\tool;
+
/**
* Migration config tool
*
* @package db
*/
-class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interface
+class config implements \phpbb\db\migration\tool\tool_interface
{
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
/**
* Constructor
*
- * @param phpbb_config $config
+ * @param \phpbb\config\config $config
*/
- public function __construct(phpbb_config $config)
+ public function __construct(\phpbb\config\config $config)
{
$this->config = $config;
}
@@ -67,7 +69,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
{
if (!isset($this->config[$config_name]))
{
- throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name);
+ throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name);
}
$this->config->set($config_name, $config_value);
@@ -88,7 +90,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
{
if (!isset($this->config[$config_name]))
{
- throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name);
+ throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name);
}
$this->config->set_atomic($config_name, $compare, $config_value);
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php
index ac4d2c9bd7..3e39d87c04 100644
--- a/phpBB/phpbb/db/migration/tool/module.php
+++ b/phpBB/phpbb/db/migration/tool/module.php
@@ -7,20 +7,22 @@
*
*/
+namespace phpbb\db\migration\tool;
+
/**
* Migration module management tool
*
* @package db
*/
-class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interface
+class module implements \phpbb\db\migration\tool\tool_interface
{
- /** @var phpbb_cache_service */
+ /** @var \phpbb\cache\service */
protected $cache;
/** @var dbal */
protected $db;
- /** @var phpbb_user */
+ /** @var \phpbb\user */
protected $user;
/** @var string */
@@ -35,14 +37,14 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
/**
* Constructor
*
- * @param phpbb_db_driver $db
+ * @param \phpbb\db\driver\driver $db
* @param mixed $cache
- * @param phpbb_user $user
+ * @param \phpbb\user $user
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $modules_table
*/
- public function __construct(phpbb_db_driver $db, phpbb_cache_service $cache, phpbb_user $user, $phpbb_root_path, $php_ext, $modules_table)
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\user $user, $phpbb_root_path, $php_ext, $modules_table)
{
$this->db = $db;
$this->cache = $cache;
@@ -133,7 +135,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
*
* @param string $class The module class(acp|mcp|ucp)
* @param int|string $parent The parent module_id|module_langname (0 for no parent)
- * @param array $data an array of the data on the new module.
+ * @param array $data an array of the data on the new \module.
* This can be setup in two different ways.
* 1. The "manual" way. For inserting a category or one at a time.
* It will be merged with the base array shown a bit below,
@@ -180,9 +182,6 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
{
// The "automatic" way
$basename = (isset($data['module_basename'])) ? $data['module_basename'] : '';
- $basename = str_replace(array('/', '\\'), '', $basename);
- $class = str_replace(array('/', '\\'), '', $class);
-
$module = $this->get_module_info($class, $basename);
$result = '';
@@ -221,14 +220,14 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
if (!$module_id)
{
- throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $parent);
+ throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent);
}
$parent = $data['parent_id'] = $module_id;
}
else if (!$this->exists($class, false, $parent))
{
- throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $parent);
+ throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent);
}
if ($this->exists($class, $parent, $data['module_langname']))
@@ -241,7 +240,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext);
$this->user->add_lang('acp/modules');
}
- $acp_modules = new acp_modules();
+ $acp_modules = new \acp_modules();
$module_data = array(
'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1,
@@ -259,7 +258,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
if (is_string($result))
{
// Error
- throw new phpbb_db_migration_exception('MODULE_ERROR', $result);
+ throw new \phpbb\db\migration\exception('MODULE_ERROR', $result);
}
else
{
@@ -347,13 +346,11 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
// Failed.
if (!isset($module['module_basename']))
{
- throw new phpbb_db_migration_exception('MODULE_NOT_EXIST');
+ throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST');
}
// Automatic method
- $basename = str_replace(array('/', '\\'), '', $module['module_basename']);
- $class = str_replace(array('/', '\\'), '', $class);
-
+ $basename = $module['module_basename'];
$module_info = $this->get_module_info($class, $basename);
foreach ($module_info['modes'] as $mode => $info)
@@ -433,7 +430,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext);
$this->user->add_lang('acp/modules');
}
- $acp_modules = new acp_modules();
+ $acp_modules = new \acp_modules();
$acp_modules->module_class = $class;
foreach ($module_ids as $module_id)
@@ -476,7 +473,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
}
/**
- * Wrapper for acp_modules::get_module_infos()
+ * Wrapper for \acp_modules::get_module_infos()
*
* @param string $class Module Class
* @param string $basename Module Basename
@@ -488,12 +485,12 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
{
include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext);
}
- $acp_modules = new acp_modules();
+ $acp_modules = new \acp_modules();
$module = $acp_modules->get_module_infos($basename, $class, true);
if (empty($module))
{
- throw new phpbb_db_migration_exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename);
+ throw new \phpbb\db\migration\exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename);
}
return array_pop($module);
diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php
index 2f09c0ac72..fd2de9c8fb 100644
--- a/phpBB/phpbb/db/migration/tool/permission.php
+++ b/phpBB/phpbb/db/migration/tool/permission.php
@@ -7,17 +7,19 @@
*
*/
+namespace phpbb\db\migration\tool;
+
/**
* Migration permission management tool
*
* @package db
*/
-class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_interface
+class permission implements \phpbb\db\migration\tool\tool_interface
{
- /** @var phpbb_auth */
+ /** @var \phpbb\auth\auth */
protected $auth;
- /** @var phpbb_cache_service */
+ /** @var \phpbb\cache\service */
protected $cache;
/** @var dbal */
@@ -32,13 +34,13 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
/**
* Constructor
*
- * @param phpbb_db_driver $db
+ * @param \phpbb\db\driver\driver $db
* @param mixed $cache
- * @param phpbb_auth $auth
+ * @param \phpbb\auth\auth $auth
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(phpbb_db_driver $db, phpbb_cache_service $cache, phpbb_auth $auth, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->cache = $cache;
@@ -117,7 +119,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
{
include($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext);
}
- $auth_admin = new auth_admin();
+ $auth_admin = new \auth_admin();
// We have to add a check to see if the !$global (if global, local, and if local, global) permission already exists. If it does, acl_add_option currently has a bug which would break the ACL system, so we are having a work-around here.
if ($this->exists($auth_option, !$global))
@@ -290,7 +292,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$role_id)
{
- throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $old_role_name);
+ throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $old_role_name);
}
$sql = 'UPDATE ' . ACL_ROLES_TABLE . "
@@ -380,7 +382,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$role_id)
{
- throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name);
+ throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $name);
}
$sql = 'SELECT auth_option_id, auth_setting
@@ -403,7 +405,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$group_id)
{
- throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name);
+ throw new \phpbb\db\migration\exception('GROUP_NOT_EXIST', $name);
}
// If the group has a role set for them we will add the requested permissions to that role.
@@ -523,7 +525,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$role_id)
{
- throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name);
+ throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $name);
}
$sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . '
@@ -540,7 +542,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$group_id)
{
- throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name);
+ throw new \phpbb\db\migration\exception('GROUP_NOT_EXIST', $name);
}
// If the group has a role set for them we will remove the requested permissions from that role.
diff --git a/phpBB/phpbb/db/migration/tool/interface.php b/phpBB/phpbb/db/migration/tool/tool_interface.php
index ced53b2023..e7b89d8858 100644
--- a/phpBB/phpbb/db/migration/tool/interface.php
+++ b/phpBB/phpbb/db/migration/tool/tool_interface.php
@@ -7,12 +7,14 @@
*
*/
+namespace phpbb\db\migration\tool;
+
/**
* Migration tool interface
*
* @package db
*/
-interface phpbb_db_migration_tool_interface
+interface tool_interface
{
/**
* Retrieve a short name used for commands in migrations.
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index ca3ffc8043..3b966b7fe3 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -7,28 +7,22 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db;
/**
* The migrator is responsible for applying new migrations in the correct order.
*
* @package db
*/
-class phpbb_db_migrator
+class migrator
{
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_db_tools */
+ /** @var \phpbb\db\tools */
protected $db_tools;
/** @var string */
@@ -71,7 +65,7 @@ class phpbb_db_migrator
/**
* Constructor of the database migrator
*/
- public function __construct(phpbb_config $config, phpbb_db_driver $db, phpbb_db_tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools)
+ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools)
{
$this->config = $config;
$this->db = $db;
@@ -190,6 +184,11 @@ class phpbb_db_migrator
foreach ($state['migration_depends_on'] as $depend)
{
+ if ($this->unfulfillable($depend) !== false)
+ {
+ throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $depend);
+ }
+
if (!isset($this->migration_state[$depend]) ||
!$this->migration_state[$depend]['migration_schema_done'] ||
!$this->migration_state[$depend]['migration_data_done'])
@@ -202,11 +201,12 @@ class phpbb_db_migrator
'name' => $name,
'class' => $migration,
'state' => $state,
+ 'task' => '',
);
if (!isset($this->migration_state[$name]))
{
- if ($migration->effectively_installed())
+ if ($state['migration_start_time'] == 0 && $migration->effectively_installed())
{
$state = array(
'migration_depends_on' => $migration->depends_on(),
@@ -225,8 +225,11 @@ class phpbb_db_migrator
}
}
+ $this->set_migration_state($name, $state);
+
if (!$state['migration_schema_done'])
{
+ $this->last_run_migration['task'] = 'apply_schema_changes';
$this->apply_schema_changes($migration->update_schema());
$state['migration_schema_done'] = true;
}
@@ -234,13 +237,14 @@ class phpbb_db_migrator
{
try
{
+ $this->last_run_migration['task'] = 'process_data_step';
$result = $this->process_data_step($migration->update_data(), $state['migration_data_state']);
$state['migration_data_state'] = ($result === true) ? '' : $result;
$state['migration_data_done'] = ($result === true);
$state['migration_end_time'] = ($result === true) ? time() : 0;
}
- catch (phpbb_db_migration_exception $e)
+ catch (\phpbb\db\migration\exception $e)
{
// Revert the schema changes
$this->revert($name);
@@ -304,6 +308,7 @@ class phpbb_db_migrator
$this->last_run_migration = array(
'name' => $name,
'class' => $migration,
+ 'task' => '',
);
if ($state['migration_data_done'])
@@ -398,7 +403,7 @@ class phpbb_db_migrator
));
}
}
- catch (phpbb_db_migration_exception $e)
+ catch (\phpbb\db\migration\exception $e)
{
// We should try rolling back here
foreach ($steps as $reverse_step_identifier => $reverse_step)
@@ -474,12 +479,12 @@ class phpbb_db_migrator
case 'if':
if (!isset($parameters[0]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step);
}
if (!isset($parameters[1]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step);
}
$condition = $parameters[0];
@@ -496,7 +501,7 @@ class phpbb_db_migrator
case 'custom':
if (!is_callable($parameters[0]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
}
return array(
@@ -508,17 +513,17 @@ class phpbb_db_migrator
default:
if (!$method)
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step);
}
if (!isset($this->tools[$class]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step);
}
if (!method_exists(get_class($this->tools[$class]), $method))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step);
}
// Attempt to reverse operations
@@ -622,6 +627,7 @@ class phpbb_db_migrator
{
continue;
}
+
return false;
}
@@ -656,7 +662,7 @@ class phpbb_db_migrator
* Helper to get a migration
*
* @param string $name Name of the migration
- * @return phpbb_db_migration
+ * @return \phpbb\db\migration\migration
*/
protected function get_migration($name)
{
@@ -694,7 +700,7 @@ class phpbb_db_migrator
/**
* Load migration data files from a directory
*
- * @param phpbb_extension_finder $finder
+ * @param \phpbb\extension\finder $finder
* @param string $path Path to migration data files
* @param bool $check_fulfillable If TRUE (default), we will check
* if all of the migrations are fulfillable after loading them.
@@ -703,11 +709,11 @@ class phpbb_db_migrator
* with the last call to prevent throwing errors unnecessarily).
* @return array Array of migration names
*/
- public function load_migrations(phpbb_extension_finder $finder, $path, $check_fulfillable = true)
+ public function load_migrations(\phpbb\extension\finder $finder, $path, $check_fulfillable = true)
{
if (!is_dir($path))
{
- throw new phpbb_db_migration_exception('DIRECTORY INVALID', $path);
+ throw new \phpbb\db\migration\exception('DIRECTORY INVALID', $path);
}
$migrations = array();
@@ -736,7 +742,7 @@ class phpbb_db_migrator
$unfulfillable = $this->unfulfillable($name);
if ($unfulfillable !== false)
{
- throw new phpbb_db_migration_exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
+ throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
}
}
}
diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php
index c18f908429..41026ad425 100644
--- a/phpBB/phpbb/db/sql_insert_buffer.php
+++ b/phpBB/phpbb/db/sql_insert_buffer.php
@@ -7,13 +7,7 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db;
/**
* Collects rows for insert into a database until the buffer size is reached.
@@ -38,7 +32,7 @@ if (!defined('IN_PHPBB'))
*
* Usage:
* <code>
-* $buffer = new phpbb_db_sql_insert_buffer($db, 'test_table', 1234);
+* $buffer = new \phpbb\db\sql_insert_buffer($db, 'test_table', 1234);
*
* while (do_stuff())
* {
@@ -53,9 +47,9 @@ if (!defined('IN_PHPBB'))
*
* @package dbal
*/
-class phpbb_db_sql_insert_buffer
+class sql_insert_buffer
{
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
/** @var string */
@@ -68,11 +62,11 @@ class phpbb_db_sql_insert_buffer
protected $buffer = array();
/**
- * @param phpbb_db_driver $db
+ * @param \phpbb\db\driver\driver $db
* @param string $table_name
* @param int $max_buffered_rows
*/
- public function __construct(phpbb_db_driver $db, $table_name, $max_buffered_rows = 500)
+ public function __construct(\phpbb\db\driver\driver $db, $table_name, $max_buffered_rows = 500)
{
$this->db = $db;
$this->table_name = $table_name;
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index 492284ffcd..4360c89ac3 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -7,13 +7,7 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\db;
/**
* Database Tools for handling cross-db actions such as altering columns, etc.
@@ -21,7 +15,7 @@ if (!defined('IN_PHPBB'))
*
* @package dbal
*/
-class phpbb_db_tools
+class tools
{
/**
* Current sql layer
@@ -31,253 +25,263 @@ class phpbb_db_tools
/**
* @var object DB object
*/
- var $db = NULL;
+ var $db = null;
/**
* The Column types for every database we support
* @var array
*/
- var $dbms_type_map = array(
- 'mysql_41' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'mediumint(8) UNSIGNED',
- 'UINT:' => 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'smallint(4) UNSIGNED',
- 'BOOL' => 'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'text',
- 'XSTEXT_UNI'=> 'varchar(100)',
- 'STEXT' => 'text',
- 'STEXT_UNI' => 'varchar(255)',
- 'TEXT' => 'text',
- 'TEXT_UNI' => 'text',
- 'MTEXT' => 'mediumtext',
- 'MTEXT_UNI' => 'mediumtext',
- 'TIMESTAMP' => 'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar(255)',
- 'VARBINARY' => 'varbinary(255)',
- ),
-
- 'mysql_40' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- '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)',
- ),
-
- 'firebird' => array(
- 'INT:' => 'INTEGER',
- 'BINT' => 'DOUBLE PRECISION',
- 'UINT' => 'INTEGER',
- 'UINT:' => 'INTEGER',
- 'TINT:' => 'INTEGER',
- 'USINT' => 'INTEGER',
- 'BOOL' => 'INTEGER',
- 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE',
- 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE',
- 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE',
- 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8',
- 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
- 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
- 'TIMESTAMP' => 'INTEGER',
- 'DECIMAL' => 'DOUBLE PRECISION',
- 'DECIMAL:' => 'DOUBLE PRECISION',
- 'PDECIMAL' => 'DOUBLE PRECISION',
- 'PDECIMAL:' => 'DOUBLE PRECISION',
- 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8',
- 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE',
- ),
-
- 'mssql' => array(
- 'INT:' => '[int]',
- 'BINT' => '[float]',
- 'UINT' => '[int]',
- 'UINT:' => '[int]',
- 'TINT:' => '[int]',
- 'USINT' => '[int]',
- 'BOOL' => '[int]',
- 'VCHAR' => '[varchar] (255)',
- 'VCHAR:' => '[varchar] (%d)',
- 'CHAR:' => '[char] (%d)',
- 'XSTEXT' => '[varchar] (1000)',
- 'STEXT' => '[varchar] (3000)',
- 'TEXT' => '[varchar] (8000)',
- 'MTEXT' => '[text]',
- 'XSTEXT_UNI'=> '[varchar] (100)',
- 'STEXT_UNI' => '[varchar] (255)',
- 'TEXT_UNI' => '[varchar] (4000)',
- 'MTEXT_UNI' => '[text]',
- 'TIMESTAMP' => '[int]',
- 'DECIMAL' => '[float]',
- 'DECIMAL:' => '[float]',
- 'PDECIMAL' => '[float]',
- 'PDECIMAL:' => '[float]',
- 'VCHAR_UNI' => '[varchar] (255)',
- 'VCHAR_UNI:'=> '[varchar] (%d)',
- 'VCHAR_CI' => '[varchar] (255)',
- 'VARBINARY' => '[varchar] (255)',
- ),
-
- 'mssqlnative' => array(
- 'INT:' => '[int]',
- 'BINT' => '[float]',
- 'UINT' => '[int]',
- 'UINT:' => '[int]',
- 'TINT:' => '[int]',
- 'USINT' => '[int]',
- 'BOOL' => '[int]',
- 'VCHAR' => '[varchar] (255)',
- 'VCHAR:' => '[varchar] (%d)',
- 'CHAR:' => '[char] (%d)',
- 'XSTEXT' => '[varchar] (1000)',
- 'STEXT' => '[varchar] (3000)',
- 'TEXT' => '[varchar] (8000)',
- 'MTEXT' => '[text]',
- 'XSTEXT_UNI'=> '[varchar] (100)',
- 'STEXT_UNI' => '[varchar] (255)',
- 'TEXT_UNI' => '[varchar] (4000)',
- 'MTEXT_UNI' => '[text]',
- 'TIMESTAMP' => '[int]',
- 'DECIMAL' => '[float]',
- 'DECIMAL:' => '[float]',
- 'PDECIMAL' => '[float]',
- 'PDECIMAL:' => '[float]',
- 'VCHAR_UNI' => '[varchar] (255)',
- 'VCHAR_UNI:'=> '[varchar] (%d)',
- 'VCHAR_CI' => '[varchar] (255)',
- 'VARBINARY' => '[varchar] (255)',
- ),
-
- 'oracle' => array(
- 'INT:' => 'number(%d)',
- 'BINT' => 'number(20)',
- 'UINT' => 'number(8)',
- 'UINT:' => 'number(%d)',
- 'TINT:' => 'number(%d)',
- 'USINT' => 'number(4)',
- 'BOOL' => 'number(1)',
- 'VCHAR' => 'varchar2(255)',
- 'VCHAR:' => 'varchar2(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'varchar2(1000)',
- 'STEXT' => 'varchar2(3000)',
- 'TEXT' => 'clob',
- 'MTEXT' => 'clob',
- 'XSTEXT_UNI'=> 'varchar2(300)',
- 'STEXT_UNI' => 'varchar2(765)',
- 'TEXT_UNI' => 'clob',
- 'MTEXT_UNI' => 'clob',
- 'TIMESTAMP' => 'number(11)',
- 'DECIMAL' => 'number(5, 2)',
- 'DECIMAL:' => 'number(%d, 2)',
- 'PDECIMAL' => 'number(6, 3)',
- 'PDECIMAL:' => 'number(%d, 3)',
- 'VCHAR_UNI' => 'varchar2(765)',
- 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')),
- 'VCHAR_CI' => 'varchar2(255)',
- 'VARBINARY' => 'raw(255)',
- ),
-
- 'sqlite' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'INTEGER UNSIGNED', //'mediumint(8) UNSIGNED',
- 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'INTEGER UNSIGNED', //'mediumint(4) UNSIGNED',
- 'BOOL' => 'INTEGER UNSIGNED', //'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'text(65535)',
- 'STEXT' => 'text(65535)',
- 'TEXT' => 'text(65535)',
- 'MTEXT' => 'mediumtext(16777215)',
- 'XSTEXT_UNI'=> 'text(65535)',
- 'STEXT_UNI' => 'text(65535)',
- 'TEXT_UNI' => 'text(65535)',
- 'MTEXT_UNI' => 'mediumtext(16777215)',
- 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar(255)',
- 'VARBINARY' => 'blob',
- ),
-
- 'postgres' => array(
- 'INT:' => 'INT4',
- 'BINT' => 'INT8',
- 'UINT' => 'INT4', // unsigned
- 'UINT:' => 'INT4', // unsigned
- 'USINT' => 'INT2', // unsigned
- 'BOOL' => 'INT2', // unsigned
- 'TINT:' => 'INT2',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'varchar(1000)',
- 'STEXT' => 'varchar(3000)',
- 'TEXT' => 'varchar(8000)',
- 'MTEXT' => 'TEXT',
- 'XSTEXT_UNI'=> 'varchar(100)',
- 'STEXT_UNI' => 'varchar(255)',
- 'TEXT_UNI' => 'varchar(4000)',
- 'MTEXT_UNI' => 'TEXT',
- 'TIMESTAMP' => 'INT4', // unsigned
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar_ci',
- 'VARBINARY' => 'bytea',
- ),
- );
+ var $dbms_type_map = array();
+
+ /**
+ * Get the column types for every database we support
+ *
+ * @return array
+ */
+ public static function get_dbms_type_map()
+ {
+ return array(
+ 'mysql_41' => array(
+ 'INT:' => 'int(%d)',
+ 'BINT' => 'bigint(20)',
+ 'UINT' => 'mediumint(8) UNSIGNED',
+ 'UINT:' => 'int(%d) UNSIGNED',
+ 'TINT:' => 'tinyint(%d)',
+ 'USINT' => 'smallint(4) UNSIGNED',
+ 'BOOL' => 'tinyint(1) UNSIGNED',
+ 'VCHAR' => 'varchar(255)',
+ 'VCHAR:' => 'varchar(%d)',
+ 'CHAR:' => 'char(%d)',
+ 'XSTEXT' => 'text',
+ 'XSTEXT_UNI'=> 'varchar(100)',
+ 'STEXT' => 'text',
+ 'STEXT_UNI' => 'varchar(255)',
+ 'TEXT' => 'text',
+ 'TEXT_UNI' => 'text',
+ 'MTEXT' => 'mediumtext',
+ 'MTEXT_UNI' => 'mediumtext',
+ 'TIMESTAMP' => 'int(11) UNSIGNED',
+ 'DECIMAL' => 'decimal(5,2)',
+ 'DECIMAL:' => 'decimal(%d,2)',
+ 'PDECIMAL' => 'decimal(6,3)',
+ 'PDECIMAL:' => 'decimal(%d,3)',
+ 'VCHAR_UNI' => 'varchar(255)',
+ 'VCHAR_UNI:'=> 'varchar(%d)',
+ 'VCHAR_CI' => 'varchar(255)',
+ 'VARBINARY' => 'varbinary(255)',
+ ),
+
+ 'mysql_40' => array(
+ 'INT:' => 'int(%d)',
+ 'BINT' => 'bigint(20)',
+ '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)',
+ ),
+
+ 'firebird' => array(
+ 'INT:' => 'INTEGER',
+ 'BINT' => 'DOUBLE PRECISION',
+ 'UINT' => 'INTEGER',
+ 'UINT:' => 'INTEGER',
+ 'TINT:' => 'INTEGER',
+ 'USINT' => 'INTEGER',
+ 'BOOL' => 'INTEGER',
+ 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE',
+ 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE',
+ 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE',
+ 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
+ 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
+ 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
+ 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
+ 'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8',
+ 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
+ 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
+ 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
+ 'TIMESTAMP' => 'INTEGER',
+ 'DECIMAL' => 'DOUBLE PRECISION',
+ 'DECIMAL:' => 'DOUBLE PRECISION',
+ 'PDECIMAL' => 'DOUBLE PRECISION',
+ 'PDECIMAL:' => 'DOUBLE PRECISION',
+ 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
+ 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8',
+ 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8',
+ 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE',
+ ),
+
+ 'mssql' => array(
+ 'INT:' => '[int]',
+ 'BINT' => '[float]',
+ 'UINT' => '[int]',
+ 'UINT:' => '[int]',
+ 'TINT:' => '[int]',
+ 'USINT' => '[int]',
+ 'BOOL' => '[int]',
+ 'VCHAR' => '[varchar] (255)',
+ 'VCHAR:' => '[varchar] (%d)',
+ 'CHAR:' => '[char] (%d)',
+ 'XSTEXT' => '[varchar] (1000)',
+ 'STEXT' => '[varchar] (3000)',
+ 'TEXT' => '[varchar] (8000)',
+ 'MTEXT' => '[text]',
+ 'XSTEXT_UNI'=> '[varchar] (100)',
+ 'STEXT_UNI' => '[varchar] (255)',
+ 'TEXT_UNI' => '[varchar] (4000)',
+ 'MTEXT_UNI' => '[text]',
+ 'TIMESTAMP' => '[int]',
+ 'DECIMAL' => '[float]',
+ 'DECIMAL:' => '[float]',
+ 'PDECIMAL' => '[float]',
+ 'PDECIMAL:' => '[float]',
+ 'VCHAR_UNI' => '[varchar] (255)',
+ 'VCHAR_UNI:'=> '[varchar] (%d)',
+ 'VCHAR_CI' => '[varchar] (255)',
+ 'VARBINARY' => '[varchar] (255)',
+ ),
+
+ 'mssqlnative' => array(
+ 'INT:' => '[int]',
+ 'BINT' => '[float]',
+ 'UINT' => '[int]',
+ 'UINT:' => '[int]',
+ 'TINT:' => '[int]',
+ 'USINT' => '[int]',
+ 'BOOL' => '[int]',
+ 'VCHAR' => '[varchar] (255)',
+ 'VCHAR:' => '[varchar] (%d)',
+ 'CHAR:' => '[char] (%d)',
+ 'XSTEXT' => '[varchar] (1000)',
+ 'STEXT' => '[varchar] (3000)',
+ 'TEXT' => '[varchar] (8000)',
+ 'MTEXT' => '[text]',
+ 'XSTEXT_UNI'=> '[varchar] (100)',
+ 'STEXT_UNI' => '[varchar] (255)',
+ 'TEXT_UNI' => '[varchar] (4000)',
+ 'MTEXT_UNI' => '[text]',
+ 'TIMESTAMP' => '[int]',
+ 'DECIMAL' => '[float]',
+ 'DECIMAL:' => '[float]',
+ 'PDECIMAL' => '[float]',
+ 'PDECIMAL:' => '[float]',
+ 'VCHAR_UNI' => '[varchar] (255)',
+ 'VCHAR_UNI:'=> '[varchar] (%d)',
+ 'VCHAR_CI' => '[varchar] (255)',
+ 'VARBINARY' => '[varchar] (255)',
+ ),
+
+ 'oracle' => array(
+ 'INT:' => 'number(%d)',
+ 'BINT' => 'number(20)',
+ 'UINT' => 'number(8)',
+ 'UINT:' => 'number(%d)',
+ 'TINT:' => 'number(%d)',
+ 'USINT' => 'number(4)',
+ 'BOOL' => 'number(1)',
+ 'VCHAR' => 'varchar2(255)',
+ 'VCHAR:' => 'varchar2(%d)',
+ 'CHAR:' => 'char(%d)',
+ 'XSTEXT' => 'varchar2(1000)',
+ 'STEXT' => 'varchar2(3000)',
+ 'TEXT' => 'clob',
+ 'MTEXT' => 'clob',
+ 'XSTEXT_UNI'=> 'varchar2(300)',
+ 'STEXT_UNI' => 'varchar2(765)',
+ 'TEXT_UNI' => 'clob',
+ 'MTEXT_UNI' => 'clob',
+ 'TIMESTAMP' => 'number(11)',
+ 'DECIMAL' => 'number(5, 2)',
+ 'DECIMAL:' => 'number(%d, 2)',
+ 'PDECIMAL' => 'number(6, 3)',
+ 'PDECIMAL:' => 'number(%d, 3)',
+ 'VCHAR_UNI' => 'varchar2(765)',
+ 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')),
+ 'VCHAR_CI' => 'varchar2(255)',
+ 'VARBINARY' => 'raw(255)',
+ ),
+
+ 'sqlite' => array(
+ 'INT:' => 'int(%d)',
+ 'BINT' => 'bigint(20)',
+ 'UINT' => 'INTEGER UNSIGNED', //'mediumint(8) UNSIGNED',
+ 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED',
+ 'TINT:' => 'tinyint(%d)',
+ 'USINT' => 'INTEGER UNSIGNED', //'mediumint(4) UNSIGNED',
+ 'BOOL' => 'INTEGER UNSIGNED', //'tinyint(1) UNSIGNED',
+ 'VCHAR' => 'varchar(255)',
+ 'VCHAR:' => 'varchar(%d)',
+ 'CHAR:' => 'char(%d)',
+ 'XSTEXT' => 'text(65535)',
+ 'STEXT' => 'text(65535)',
+ 'TEXT' => 'text(65535)',
+ 'MTEXT' => 'mediumtext(16777215)',
+ 'XSTEXT_UNI'=> 'text(65535)',
+ 'STEXT_UNI' => 'text(65535)',
+ 'TEXT_UNI' => 'text(65535)',
+ 'MTEXT_UNI' => 'mediumtext(16777215)',
+ 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED',
+ 'DECIMAL' => 'decimal(5,2)',
+ 'DECIMAL:' => 'decimal(%d,2)',
+ 'PDECIMAL' => 'decimal(6,3)',
+ 'PDECIMAL:' => 'decimal(%d,3)',
+ 'VCHAR_UNI' => 'varchar(255)',
+ 'VCHAR_UNI:'=> 'varchar(%d)',
+ 'VCHAR_CI' => 'varchar(255)',
+ 'VARBINARY' => 'blob',
+ ),
+
+ 'postgres' => array(
+ 'INT:' => 'INT4',
+ 'BINT' => 'INT8',
+ 'UINT' => 'INT4', // unsigned
+ 'UINT:' => 'INT4', // unsigned
+ 'USINT' => 'INT2', // unsigned
+ 'BOOL' => 'INT2', // unsigned
+ 'TINT:' => 'INT2',
+ 'VCHAR' => 'varchar(255)',
+ 'VCHAR:' => 'varchar(%d)',
+ 'CHAR:' => 'char(%d)',
+ 'XSTEXT' => 'varchar(1000)',
+ 'STEXT' => 'varchar(3000)',
+ 'TEXT' => 'varchar(8000)',
+ 'MTEXT' => 'TEXT',
+ 'XSTEXT_UNI'=> 'varchar(100)',
+ 'STEXT_UNI' => 'varchar(255)',
+ 'TEXT_UNI' => 'varchar(4000)',
+ 'MTEXT_UNI' => 'TEXT',
+ 'TIMESTAMP' => 'INT4', // unsigned
+ 'DECIMAL' => 'decimal(5,2)',
+ 'DECIMAL:' => 'decimal(%d,2)',
+ 'PDECIMAL' => 'decimal(6,3)',
+ 'PDECIMAL:' => 'decimal(%d,3)',
+ 'VCHAR_UNI' => 'varchar(255)',
+ 'VCHAR_UNI:'=> 'varchar(%d)',
+ 'VCHAR_CI' => 'varchar_ci',
+ 'VARBINARY' => 'bytea',
+ ),
+ );
+ }
/**
* A list of types being unsigned for better reference in some db's
@@ -300,14 +304,16 @@ class phpbb_db_tools
/**
* Constructor. Set DB Object and set {@link $return_statements return_statements}.
*
- * @param phpbb_db_driver $db Database connection
+ * @param \phpbb\db\driver\driver $db Database connection
* @param bool $return_statements True if only statements should be returned and no SQL being executed
*/
- public function __construct(phpbb_db_driver $db, $return_statements = false)
+ public function __construct(\phpbb\db\driver\driver $db, $return_statements = false)
{
$this->db = $db;
$this->return_statements = $return_statements;
+ $this->dbms_type_map = self::get_dbms_type_map();
+
// Determine mapping database type
switch ($this->db->sql_layer)
{