From 7f58a4572eaca75aecff2da889e67ea151616011 Mon Sep 17 00:00:00 2001 From: Marc Alexander <admin@m-a-styles.de> Date: Mon, 28 Oct 2013 22:27:25 +0100 Subject: [ticket/11981] Fix code sniffer complaints PHPBB3-11981 --- phpBB/phpbb/db/migration/data/v310/notifications.php | 2 +- phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php | 6 +++--- phpBB/phpbb/db/migration/data/v310/style_update_p2.php | 8 ++++---- phpBB/phpbb/db/migration/data/v310/teampage.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/data/v310/notifications.php b/phpBB/phpbb/db/migration/data/v310/notifications.php index 10f1392094..61be25bb5f 100644 --- a/phpBB/phpbb/db/migration/data/v310/notifications.php +++ b/phpBB/phpbb/db/migration/data/v310/notifications.php @@ -34,7 +34,7 @@ class notifications extends \phpbb\db\migration\migration ), $this->table_prefix . 'notifications' => array( 'COLUMNS' => array( - 'notification_id' => array('UINT', NULL, 'auto_increment'), + 'notification_id' => array('UINT', null, 'auto_increment'), 'item_type' => array('VCHAR:255', ''), 'item_id' => array('UINT', 0), 'item_parent_id' => array('UINT', 0), diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php index 8ed626d8a6..eb2eb361ee 100644 --- a/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php +++ b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php @@ -26,7 +26,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration 'add_tables' => array( $this->table_prefix . 'notification_types' => array( 'COLUMNS' => array( - 'notification_type_id' => array('USINT', NULL, 'auto_increment'), + 'notification_type_id' => array('USINT', null, 'auto_increment'), 'notification_type_name' => array('VCHAR:255', ''), 'notification_type_enabled' => array('BOOL', 1), ), @@ -37,7 +37,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration ), $this->table_prefix . 'notifications' => array( 'COLUMNS' => array( - 'notification_id' => array('UINT:10', NULL, 'auto_increment'), + 'notification_id' => array('UINT:10', null, 'auto_increment'), 'notification_type_id' => array('USINT', 0), 'item_id' => array('UINT', 0), 'item_parent_id' => array('UINT', 0), @@ -73,7 +73,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration ), $this->table_prefix . 'notifications' => array( 'COLUMNS' => array( - 'notification_id' => array('UINT', NULL, 'auto_increment'), + 'notification_id' => array('UINT', null, 'auto_increment'), 'item_type' => array('VCHAR:255', ''), 'item_id' => array('UINT', 0), 'item_parent_id' => array('UINT', 0), diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php index 202a8409fb..c5b45d9dc9 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php @@ -56,7 +56,7 @@ class style_update_p2 extends \phpbb\db\migration\migration 'add_tables' => array( $this->table_prefix . 'styles_imageset' => array( 'COLUMNS' => array( - 'imageset_id' => array('UINT', NULL, 'auto_increment'), + 'imageset_id' => array('UINT', null, 'auto_increment'), 'imageset_name' => array('VCHAR_UNI:255', ''), 'imageset_copyright' => array('VCHAR_UNI', ''), 'imageset_path' => array('VCHAR:100', ''), @@ -68,7 +68,7 @@ class style_update_p2 extends \phpbb\db\migration\migration ), $this->table_prefix . 'styles_imageset_data' => array( 'COLUMNS' => array( - 'image_id' => array('UINT', NULL, 'auto_increment'), + 'image_id' => array('UINT', null, 'auto_increment'), 'image_name' => array('VCHAR:200', ''), 'image_filename' => array('VCHAR:200', ''), 'image_lang' => array('VCHAR:30', ''), @@ -83,7 +83,7 @@ class style_update_p2 extends \phpbb\db\migration\migration ), $this->table_prefix . 'styles_template' => array( 'COLUMNS' => array( - 'template_id' => array('UINT', NULL, 'auto_increment'), + 'template_id' => array('UINT', null, 'auto_increment'), 'template_name' => array('VCHAR_UNI:255', ''), 'template_copyright' => array('VCHAR_UNI', ''), 'template_path' => array('VCHAR:100', ''), @@ -112,7 +112,7 @@ class style_update_p2 extends \phpbb\db\migration\migration ), $this->table_prefix . 'styles_theme' => array( 'COLUMNS' => array( - 'theme_id' => array('UINT', NULL, 'auto_increment'), + 'theme_id' => array('UINT', null, 'auto_increment'), 'theme_name' => array('VCHAR_UNI:255', ''), 'theme_copyright' => array('VCHAR_UNI', ''), 'theme_path' => array('VCHAR:100', ''), diff --git a/phpBB/phpbb/db/migration/data/v310/teampage.php b/phpBB/phpbb/db/migration/data/v310/teampage.php index 80cc4be1c0..172435c672 100644 --- a/phpBB/phpbb/db/migration/data/v310/teampage.php +++ b/phpBB/phpbb/db/migration/data/v310/teampage.php @@ -27,7 +27,7 @@ class teampage extends \phpbb\db\migration\migration 'add_tables' => array( $this->table_prefix . 'teampage' => array( 'COLUMNS' => array( - 'teampage_id' => array('UINT', NULL, 'auto_increment'), + 'teampage_id' => array('UINT', null, 'auto_increment'), 'group_id' => array('UINT', 0), 'teampage_name' => array('VCHAR_UNI:255', ''), 'teampage_position' => array('UINT', 0), -- cgit v1.2.1 From 7aa8f6461f1e85cf91931f56b95384e54fec07c2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer <bantu@phpbb.com> Date: Wed, 30 Oct 2013 13:05:28 +0100 Subject: [task/code-sniffer] Remove the IN_PHPBB check side-effect from class files. PHPBB3-11980 --- phpBB/phpbb/db/migration/exception.php | 8 -------- phpBB/phpbb/db/migration/migration.php | 8 -------- 2 files changed, 16 deletions(-) (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php index 58e29b5218..cfe546d1ab 100644 --- a/phpBB/phpbb/db/migration/exception.php +++ b/phpBB/phpbb/db/migration/exception.php @@ -9,14 +9,6 @@ namespace phpbb\db\migration; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * The migrator is responsible for applying new migrations in the correct order. * diff --git a/phpBB/phpbb/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php index aff3837279..b32de00871 100644 --- a/phpBB/phpbb/db/migration/migration.php +++ b/phpBB/phpbb/db/migration/migration.php @@ -9,14 +9,6 @@ namespace phpbb\db\migration; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * Abstract base class for database migrations * -- cgit v1.2.1 From 414a4d587e0d19795cc621c4eb482b1c90e22251 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Sat, 2 Nov 2013 18:13:11 +0100 Subject: [ticket/11995] Fix Revert of config.remove PHPBB3-11995 --- phpBB/phpbb/db/migration/tool/config.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index f2149dc59a..36a1931f4e 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -130,6 +130,10 @@ class config implements \phpbb\db\migration\tool\tool_interface case 'remove': $call = 'add'; + if (sizeof($arguments) == 1) + { + $arguments[] = ''; + } break; case 'update_if_equals': -- cgit v1.2.1 From 6f33954757a05044c8700a70051ae25e3a5cc627 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Fri, 8 Nov 2013 17:37:52 +0100 Subject: [ticket/11922] Drop all keys before trying to delete columns to avoid issues On MSSQL columns that have an index can not be dropped. PHPBB3-11922 --- phpBB/phpbb/db/migration/data/v310/softdelete_p2.php | 6 +++++- phpBB/phpbb/db/migration/data/v310/style_update_p2.php | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php index 0c32e474f4..38b190c766 100644 --- a/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php @@ -34,7 +34,10 @@ class softdelete_p2 extends \phpbb\db\migration\migration ), 'drop_keys' => array( $this->table_prefix . 'posts' => array('post_approved'), - $this->table_prefix . 'topics' => array('forum_appr_last'), + $this->table_prefix . 'topics' => array( + 'forum_appr_last', + 'topic_approved', + ), ), ); } @@ -63,6 +66,7 @@ class softdelete_p2 extends \phpbb\db\migration\migration ), $this->table_prefix . 'topics' => array( 'forum_appr_last' => array('forum_id', 'topic_approved', 'topic_last_post_id'), + 'topic_approved' => array('topic_approved'), ), ), ); diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php index c5b45d9dc9..40d6a4dbbd 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php @@ -24,6 +24,14 @@ class style_update_p2 extends \phpbb\db\migration\migration public function update_schema() { return array( + 'drop_keys' => array( + $this->table_prefix . 'styles' => array( + 'imageset_id', + 'template_id', + 'theme_id', + ), + ), + 'drop_columns' => array( $this->table_prefix . 'styles' => array( 'imageset_id', @@ -53,6 +61,14 @@ class style_update_p2 extends \phpbb\db\migration\migration ), ), + 'add_index' => array( + $this->table_prefix . 'styles' => array( + 'imageset_id' => array('imageset_id'), + 'template_id' => array('template_id'), + 'theme_id' => array('theme_id'), + ), + ), + 'add_tables' => array( $this->table_prefix . 'styles_imageset' => array( 'COLUMNS' => array( -- cgit v1.2.1 From a353673e7c3e5a5a4720bea008e1df60c1401ae2 Mon Sep 17 00:00:00 2001 From: Lukasz <luki_9@wp.pl> Date: Thu, 7 Nov 2013 22:06:48 +0100 Subject: [ticket/12005] Remove PM popup module from DB PHPBB3-12005 --- .../db/migration/data/v310/ucp_popuppm_module.php | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php b/phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php new file mode 100644 index 0000000000..f8ada6c6f5 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/ucp_popuppm_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 ucp_popuppm_module extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'ucp' + AND module_langname = 'UCP_PM_POPUP_TITLE'"; + $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( + 'ucp', + 'UCP_PM', + 'UCP_PM_POPUP_TITLE', + )), + ); + } +} -- cgit v1.2.1 From 50896305fa9b5b0db733ae4a401c9bd0a85cabe9 Mon Sep 17 00:00:00 2001 From: Cesar G <prototech91@gmail.com> Date: Wed, 13 Nov 2013 23:57:39 -0800 Subject: [ticket/12008] The read_notification_last_gc config setting should be dynamic. PHPBB3-12008 --- .../migration/data/v310/notifications_cron_p2.php | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php b/phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php new file mode 100644 index 0000000000..050e679cc0 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.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_p2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\notifications_cron'); + } + + public function update_data() + { + return array( + // Make read_notification_last_gc dynamic. + array('config.remove', array('read_notification_last_gc')), + array('config.add', array('read_notification_last_gc', 0, 1)), + ); + } +} -- cgit v1.2.1 From 7678186b0907e0852eabcd1f4ed2041a8a45060d Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 13 Nov 2013 23:19:47 +0100 Subject: [prep-release-3.1.0-a2] Add migration for 3.1.0-a2 --- phpBB/phpbb/db/migration/data/v310/alpha2.php | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v310/alpha2.php (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/data/v310/alpha2.php b/phpBB/phpbb/db/migration/data/v310/alpha2.php new file mode 100644 index 0000000000..3c0853f924 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/alpha2.php @@ -0,0 +1,28 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2 +* +*/ + +namespace phpbb\db\migration\data\v310; + +class alpha2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\alpha1', + '\phpbb\db\migration\data\v310\notifications_cron_p2', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-a2')), + ); + } +} -- cgit v1.2.1 From 6db967bdd51c7df79ec7095e6d5dc506fbf3f132 Mon Sep 17 00:00:00 2001 From: Marc Alexander <admin@m-a-styles.de> Date: Wed, 20 Nov 2013 17:07:53 +0100 Subject: [ticket/11842] Add migration file for updating avatar type in database PHPBB3-11842 --- .../phpbb/db/migration/data/v310/avatar_types.php | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v310/avatar_types.php (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/data/v310/avatar_types.php b/phpBB/phpbb/db/migration/data/v310/avatar_types.php new file mode 100644 index 0000000000..439e20889c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/avatar_types.php @@ -0,0 +1,65 @@ +<?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 avatar_types extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + '\phpbb\db\migration\data\v310\avatars', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_user_avatar_type'))), + array('custom', array(array($this, 'update_group_avatar_type'))), + ); + } + + public function update_user_avatar_type() + { + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = 'avatar.driver.upload' + WHERE user_avatar_type = " . AVATAR_UPLOAD; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = 'avatar.driver.remote' + WHERE user_avatar_type = " . AVATAR_REMOTE; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = 'avatar.driver.local' + WHERE user_avatar_type = " . AVATAR_GALLERY; + $this->db->sql_query($sql); + } + + public function update_group_avatar_type() + { + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = 'avatar.driver.upload' + WHERE group_avatar_type = " . AVATAR_UPLOAD; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = 'avatar.driver.remote' + WHERE group_avatar_type = " . AVATAR_REMOTE; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = 'avatar.driver.local' + WHERE group_avatar_type = " . AVATAR_GALLERY; + $this->db->sql_query($sql); + } +} -- cgit v1.2.1 From 0d4bf3ff45a76dcb763c76502944aa7bf78b690b Mon Sep 17 00:00:00 2001 From: Marc Alexander <admin@m-a-styles.de> Date: Mon, 25 Nov 2013 13:12:08 +0100 Subject: [ticket/11842] Use type map for updating avatar types in database PHPBB3-11842 --- .../phpbb/db/migration/data/v310/avatar_types.php | 51 ++++++++++------------ 1 file changed, 23 insertions(+), 28 deletions(-) (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/data/v310/avatar_types.php b/phpBB/phpbb/db/migration/data/v310/avatar_types.php index 439e20889c..5750a43ddd 100644 --- a/phpBB/phpbb/db/migration/data/v310/avatar_types.php +++ b/phpBB/phpbb/db/migration/data/v310/avatar_types.php @@ -11,6 +11,15 @@ namespace phpbb\db\migration\data\v310; class avatar_types extends \phpbb\db\migration\migration { + /** + * @var avatar type map + */ + protected $avatar_type_map = array( + AVATAR_UPLOAD => 'avatar.driver.upload', + AVATAR_REMOTE => 'avatar.driver.remote', + AVATAR_GALLERY => 'avatar.driver.local', + ); + static public function depends_on() { return array( @@ -29,37 +38,23 @@ class avatar_types extends \phpbb\db\migration\migration public function update_user_avatar_type() { - $sql = 'UPDATE ' . $this->table_prefix . "users - SET user_avatar_type = 'avatar.driver.upload' - WHERE user_avatar_type = " . AVATAR_UPLOAD; - $this->db->sql_query($sql); - - $sql = 'UPDATE ' . $this->table_prefix . "users - SET user_avatar_type = 'avatar.driver.remote' - WHERE user_avatar_type = " . AVATAR_REMOTE; - $this->db->sql_query($sql); - - $sql = 'UPDATE ' . $this->table_prefix . "users - SET user_avatar_type = 'avatar.driver.local' - WHERE user_avatar_type = " . AVATAR_GALLERY; - $this->db->sql_query($sql); + foreach ($this->avatar_type_map as $old => $new) + { + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = '$new' + WHERE user_avatar_type = $old"; + $this->db->sql_query($sql); + } } public function update_group_avatar_type() { - $sql = 'UPDATE ' . $this->table_prefix . "groups - SET group_avatar_type = 'avatar.driver.upload' - WHERE group_avatar_type = " . AVATAR_UPLOAD; - $this->db->sql_query($sql); - - $sql = 'UPDATE ' . $this->table_prefix . "groups - SET group_avatar_type = 'avatar.driver.remote' - WHERE group_avatar_type = " . AVATAR_REMOTE; - $this->db->sql_query($sql); - - $sql = 'UPDATE ' . $this->table_prefix . "groups - SET group_avatar_type = 'avatar.driver.local' - WHERE group_avatar_type = " . AVATAR_GALLERY; - $this->db->sql_query($sql); + foreach ($this->avatar_type_map as $old => $new) + { + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = '$new' + WHERE group_avatar_type = $old"; + $this->db->sql_query($sql); + } } } -- cgit v1.2.1 From 53be0a4432aa04b916c7e9d08785f97d8e6eb355 Mon Sep 17 00:00:00 2001 From: Marc Alexander <admin@m-a-styles.de> Date: Wed, 4 Dec 2013 23:40:38 +0100 Subject: [ticket/12058] Add missing apostrophe to avatar_types migration queries PHPBB3-12058 --- phpBB/phpbb/db/migration/data/v310/avatar_types.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/db/migration') diff --git a/phpBB/phpbb/db/migration/data/v310/avatar_types.php b/phpBB/phpbb/db/migration/data/v310/avatar_types.php index 5750a43ddd..bdbdccf0c5 100644 --- a/phpBB/phpbb/db/migration/data/v310/avatar_types.php +++ b/phpBB/phpbb/db/migration/data/v310/avatar_types.php @@ -42,7 +42,7 @@ class avatar_types extends \phpbb\db\migration\migration { $sql = 'UPDATE ' . $this->table_prefix . "users SET user_avatar_type = '$new' - WHERE user_avatar_type = $old"; + WHERE user_avatar_type = '$old'"; $this->db->sql_query($sql); } } @@ -53,7 +53,7 @@ class avatar_types extends \phpbb\db\migration\migration { $sql = 'UPDATE ' . $this->table_prefix . "groups SET group_avatar_type = '$new' - WHERE group_avatar_type = $old"; + WHERE group_avatar_type = '$old'"; $this->db->sql_query($sql); } } -- cgit v1.2.1