diff options
Diffstat (limited to 'phpBB/phpbb/db')
| -rw-r--r-- | phpBB/phpbb/db/driver/driver.php | 6 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/firebird.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mssql.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mssql_base.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mssql_odbc.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mssqlnative.php | 6 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mysql.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mysql_base.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mysqli.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/oracle.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/postgres.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/sqlite.php | 4 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php | 33 | ||||
| -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) | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php | 33 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php | 33 | ||||
| -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) | 4 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 8 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 8 | ||||
| -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) | 6 | ||||
| -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) | 8 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -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) | 6 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php | 42 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php | 73 | ||||
| -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.php | 27 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v310/namespaces.php | 30 | ||||
| -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) | 6 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v310/notifications_cron.php | 27 | ||||
| -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) | 6 | ||||
| -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.php (renamed from phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php) | 8 | ||||
| -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) | 6 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v310/teampage.php (renamed from phpBB/phpbb/db/migration/data/310/teampage.php) | 6 | ||||
| -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.php | 12 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/migration.php | 18 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/tool/config.php | 14 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/tool/module.php | 41 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/tool/permission.php | 26 | ||||
| -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.php | 52 | ||||
| -rw-r--r-- | phpBB/phpbb/db/sql_insert_buffer.php | 12 | ||||
| -rw-r--r-- | phpBB/phpbb/db/tools.php | 502 | 
86 files changed, 996 insertions, 481 deletions
diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 08c966c07a..53d39e9127 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))  * Database Abstraction Layer  * @package dbal  */ -class phpbb_db_driver +class driver  {  	var $db_connect_id;  	var $query_result; @@ -82,7 +84,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..2df5eaf369 100644 --- a/phpBB/phpbb/db/driver/firebird.php +++ b/phpBB/phpbb/db/driver/firebird.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))  * 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; diff --git a/phpBB/phpbb/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php index 89c2c2351b..4d2cd287da 100644 --- a/phpBB/phpbb/db/driver/mssql.php +++ b/phpBB/phpbb/db/driver/mssql.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))  * 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 = ''; diff --git a/phpBB/phpbb/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php index 56c111c871..57c4e0f1fd 100644 --- a/phpBB/phpbb/db/driver/mssql_base.php +++ b/phpBB/phpbb/db/driver/mssql_base.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))  * 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..9db34a69fb 100644 --- a/phpBB/phpbb/db/driver/mssql_odbc.php +++ b/phpBB/phpbb/db/driver/mssql_odbc.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -26,7 +28,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 = ''; diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index 28fc88298a..e6002fe1a3 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -11,6 +11,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -56,7 +58,7 @@ class result_mssqlnative  		{  			if (is_array($value))  			{ -				$obj->$key = new stdClass(); +				$obj->$key = new \stdClass();  				array_to_obj($value, $obj->$key);  			}  			else @@ -191,7 +193,7 @@ class result_mssqlnative  /**  * @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 $last_query_text = ''; diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php index f3744ac09d..c76126763d 100644 --- a/phpBB/phpbb/db/driver/mysql.php +++ b/phpBB/phpbb/db/driver/mysql.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -24,7 +26,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 = ''; diff --git a/phpBB/phpbb/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php index ba44ea61aa..8f2f66674b 100644 --- a/phpBB/phpbb/db/driver/mysql_base.php +++ b/phpBB/phpbb/db/driver/mysql_base.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))  * 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..4d0e43b464 100644 --- a/phpBB/phpbb/db/driver/mysqli.php +++ b/phpBB/phpbb/db/driver/mysqli.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -21,7 +23,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 = ''; diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index e21e07055d..5dfab21455 100644 --- a/phpBB/phpbb/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))  * 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 = ''; diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 14854d179d..7a98b90c73 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))  * 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 +86,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 +97,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);  		} diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php index 7188f0daa2..a548fd2618 100644 --- a/phpBB/phpbb/db/driver/sqlite.php +++ b/phpBB/phpbb/db/driver/sqlite.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\driver; +  /**  * @ignore  */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))  * 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 = ''; 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 c5b1681d96..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_1 extends phpbb_db_migration  	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 640fcbc16f..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_10 extends phpbb_db_migration  	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 e0aca09c3a..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration  	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 394e030acf..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration  	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 92900e3aed..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration  	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 3be03cec40..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_11 extends phpbb_db_migration  	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 f7b0247fdb..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration  	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 204aa314ac..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration  	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 31d37afa48..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 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 984b8fb37e..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,7 +7,9 @@  *  */ -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()  	{ 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 6e11e5a145..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_2 extends phpbb_db_migration  	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 9a25628f25..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration  	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 6c37d6701b..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration  	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 11fd2a2e80..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_3 extends phpbb_db_migration  	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 cbeb00499a..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration  	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 4375a96dac..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_4 extends phpbb_db_migration  	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 73334dcc6f..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration  	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 2700274f35..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_5 extends phpbb_db_migration  	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 90c6b3b46a..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1 extends phpbb_db_migration  	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 2d1e5cfed8..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration  	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 1877b0c5a1..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6 extends phpbb_db_migration  	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 3e2a9544c7..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration  	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 439e25b100..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration  	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 77b62d7fc7..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration  	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 61a31d09e6..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration  	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 3eb1caddbc..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_7 extends phpbb_db_migration  	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 c7b5c584ac..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_7_pl1 extends phpbb_db_migration  	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 e0fd313834..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration  	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 f4f3327385..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration  	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 77771a9acd..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_8 extends phpbb_db_migration  	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 c534cabb6c..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration  	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 6a38793269..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9 extends phpbb_db_migration  	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 81c67550bd..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration  	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 1531f408b7..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration  	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 851680b093..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration  	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 879538c341..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,7 +7,9 @@  *  */ -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()  	{ @@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration  	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/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/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..10f1392094 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() 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..8ed626d8a6 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() 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/310/softdelete_mcp_modules.php b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php index f80f55d19a..d1a31815b2 100644 --- a/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php +++ b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php @@ -7,7 +7,9 @@  *  */ -class phpbb_db_migration_data_310_softdelete_mcp_modules extends phpbb_db_migration +namespace phpbb\db\migration\data\v310; + +class softdelete_mcp_modules extends \phpbb\db\migration\migration  {  	public function effectively_installed()  	{ @@ -26,8 +28,8 @@ class phpbb_db_migration_data_310_softdelete_mcp_modules extends phpbb_db_migrat  	static public function depends_on()  	{  		return array( -			'phpbb_db_migration_data_310_dev', -			'phpbb_db_migration_data_310_softdelete_p2', +			'\phpbb\db\migration\data\v310\dev', +			'\phpbb\db\migration\data\v310\softdelete_p2',  		);  	} 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..202a8409fb 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() diff --git a/phpBB/phpbb/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/v310/teampage.php index 4e77da17b7..80cc4be1c0 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() 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..58e29b5218 100644 --- a/phpBB/phpbb/db/migration/exception.php +++ b/phpBB/phpbb/db/migration/exception.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\migration; +  /**  * @ignore  */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))  *  * @package db  */ -class phpbb_db_migration_exception extends \Exception +class exception extends \Exception  {  	/**  	* Extra parameters sent to exception to aid in debugging @@ -64,12 +66,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..aff3837279 100644 --- a/phpBB/phpbb/db/migration/migration.php +++ b/phpBB/phpbb/db/migration/migration.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db\migration; +  /**  * @ignore  */ @@ -24,15 +26,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 +55,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..47e1406043 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db; +  /**  * @ignore  */ @@ -20,15 +22,15 @@ if (!defined('IN_PHPBB'))  *  * @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 +73,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 +192,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 +209,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 +233,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 +245,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 +316,7 @@ class phpbb_db_migrator  		$this->last_run_migration = array(  			'name'	=> $name,  			'class'	=> $migration, +			'task'	=> '',  		);  		if ($state['migration_data_done']) @@ -398,7 +411,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 +487,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 +509,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 +521,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 +635,7 @@ class phpbb_db_migrator  				{  					continue;  				} +  				return false;  			} @@ -656,7 +670,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 +708,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 +717,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 +750,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..7bbd213bdc 100644 --- a/phpBB/phpbb/db/sql_insert_buffer.php +++ b/phpBB/phpbb/db/sql_insert_buffer.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db; +  /**  * @ignore  */ @@ -38,7 +40,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 +55,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 +70,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..1f156fbb04 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -7,6 +7,8 @@  *  */ +namespace phpbb\db; +  /**  * @ignore  */ @@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))  *  * @package dbal  */ -class phpbb_db_tools +class tools  {  	/**  	* Current sql layer @@ -37,247 +39,257 @@ class phpbb_db_tools  	* 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 +312,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)  		{  | 
