diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 6ff6cee39e6..4290e103221 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -844,11 +844,8 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_website', 'profilefields.type.url', 'phpbb_website', '40', '12', '255', '', '', '', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 2, 1, 'VISIT_WEBSITE', '%s'); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_interests', 'profilefields.type.text', 'phpbb_interests', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, '', ''); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_occupation', 'profilefields.type.text', 'phpbb_occupation', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, '', ''); -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_icq', 'profilefields.type.string', 'phpbb_icq', '20', '3', '15', '', '', '[0-9]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 6, 1, 'SEND_ICQ_MESSAGE', 'https://www.icq.com/people/%s/'); -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'ymsgr:sendim?%s'); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_facebook', 'profilefields.type.string', 'phpbb_facebook', '20', '5', '50', '', '', '[\w.]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 9, 1, 'VIEW_FACEBOOK_PROFILE', 'https://facebook.com/%s/'); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'https://x.com/%s'); -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_skype', 'profilefields.type.string', 'phpbb_skype', '20', '6', '32', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 11, 1, 'VIEW_SKYPE_PROFILE', 'skype:%s?userinfo'); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_youtube', 'profilefields.type.string', 'phpbb_youtube', '20', '3', '60', '', '', '(@[a-zA-Z0-9_.-]{3,30}|c/[a-zA-Z][\w\.,\-_]+|(channel|user)/[a-zA-Z][\w\.,\-_]+)', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 12, 1, 'VIEW_YOUTUBE_PROFILE', 'https://youtube.com/%s'); # User Notification Options (for first user) diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index e95c5a4095a..4e466f623b7 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -119,10 +119,8 @@ 'SELECT_SORT_METHOD' => 'Select sort method', 'SENDER_EMAIL_ADDRESS' => 'Your email address', 'SENDER_NAME' => 'Your name', - 'SEND_ICQ_MESSAGE' => 'Send ICQ message', 'SEND_IM' => 'Instant messaging', 'SEND_MESSAGE' => 'Message', - 'SEND_YIM_MESSAGE' => 'Send YIM message', 'SORT_EMAIL' => 'Email', 'SORT_LAST_ACTIVE' => 'Last active', 'SORT_POST_COUNT' => 'Post count', @@ -142,7 +140,6 @@ 'VIEWING_PROFILE' => 'Viewing profile - %s', 'VIEW_FACEBOOK_PROFILE' => 'View Facebook Profile', - 'VIEW_SKYPE_PROFILE' => 'View Skype Profile', 'VIEW_TWITTER_PROFILE' => 'View X Profile', 'VIEW_YOUTUBE_PROFILE' => 'View YouTube Profile', )); diff --git a/phpBB/phpbb/db/migration/data/v400/remove_defunct_profilefields.php b/phpBB/phpbb/db/migration/data/v400/remove_defunct_profilefields.php new file mode 100644 index 00000000000..a04862377a9 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v400/remove_defunct_profilefields.php @@ -0,0 +1,234 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v400; + +class remove_defunct_profilefields extends \phpbb\db\migration\migration +{ + /** + * Default profile fields of instant messaging services that no longer exist: + * ICQ was shut down in 2024, Skype in 2025 and Yahoo Messenger in 2018. + * + * @return array Field data of the removed fields, keyed by field name + */ + protected function get_removed_fields(): array + { + return [ + 'phpbb_icq' => [ + 'field_name' => 'phpbb_icq', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_icq', + 'field_length' => '20', + 'field_minlen' => '3', + 'field_maxlen' => '15', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[0-9]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_on_ml' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 0, + 'field_is_contact' => 1, + 'field_contact_desc' => 'SEND_ICQ_MESSAGE', + 'field_contact_url' => 'https://www.icq.com/people/%s/', + ], + 'phpbb_yahoo' => [ + 'field_name' => 'phpbb_yahoo', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_yahoo', + 'field_length' => '40', + 'field_minlen' => '5', + 'field_maxlen' => '255', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '.*', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_on_ml' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 0, + 'field_is_contact' => 1, + 'field_contact_desc' => 'SEND_YIM_MESSAGE', + 'field_contact_url' => 'ymsgr:sendim?%s', + ], + 'phpbb_skype' => [ + 'field_name' => 'phpbb_skype', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_skype', + 'field_length' => '20', + 'field_minlen' => '6', + 'field_maxlen' => '32', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[a-zA-Z][\w\.,\-_]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_on_ml' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VIEW_SKYPE_PROFILE', + 'field_contact_url' => 'skype:%s?userinfo', + ], + ]; + } + + public function effectively_installed() + { + foreach ($this->get_removed_fields() as $field_name => $field_data) + { + if ($this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields_data', 'pf_' . $field_name)) + { + return false; + } + } + + return true; + } + + public static function depends_on() + { + return [ + '\phpbb\db\migration\data\v400\v400a2', + ]; + } + + public function update_schema() + { + return [ + 'drop_columns' => [ + $this->table_prefix . 'profile_fields_data' => [ + 'pf_phpbb_icq', + 'pf_phpbb_yahoo', + 'pf_phpbb_skype', + ], + ], + ]; + } + + public function revert_schema() + { + return [ + 'add_columns' => [ + $this->table_prefix . 'profile_fields_data' => [ + 'pf_phpbb_icq' => ['VCHAR', ''], + 'pf_phpbb_yahoo' => ['VCHAR', ''], + 'pf_phpbb_skype' => ['VCHAR', ''], + ], + ], + ]; + } + + public function update_data() + { + return [ + ['custom', [[$this, 'delete_custom_profile_field_data']]], + ]; + } + + public function revert_data() + { + return [ + ['custom', [[$this, 'create_custom_fields']]], + ]; + } + + public function delete_custom_profile_field_data() + { + foreach ($this->get_removed_fields() as $field_name => $field_data) + { + $sql = 'SELECT field_id + FROM ' . PROFILE_FIELDS_TABLE . " + WHERE field_name = '" . $this->db->sql_escape($field_name) . "'"; + $result = $this->db->sql_query($sql); + $field_id = (int) $this->db->sql_fetchfield('field_id'); + $this->db->sql_freeresult($result); + + if (!$field_id) + { + continue; + } + + $sql = 'DELETE FROM ' . PROFILE_FIELDS_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + } + } + + public function create_custom_fields() + { + $sql = 'SELECT MAX(field_order) as max_field_order + FROM ' . PROFILE_FIELDS_TABLE; + $result = $this->db->sql_query($sql); + $max_field_order = (int) $this->db->sql_fetchfield('max_field_order'); + $this->db->sql_freeresult($result); + + $lang_ids = []; + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE; + $result = $this->db->sql_query($sql); + while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) + { + $lang_ids[] = $lang_id; + } + $this->db->sql_freeresult($result); + + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE); + + foreach ($this->get_removed_fields() as $field_name => $field_data) + { + $field_data['field_order'] = ++$max_field_order; + + $sql = 'INSERT INTO ' . PROFILE_FIELDS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $field_data); + $this->db->sql_query($sql); + $field_id = (int) $this->db->sql_nextid(); + + foreach ($lang_ids as $lang_id) + { + $insert_buffer->insert([ + 'field_id' => (int) $field_id, + 'lang_id' => (int) $lang_id, + 'lang_name' => strtoupper(substr($field_name, 6)), + 'lang_explain' => '', + 'lang_default_value' => '', + ]); + } + } + + $insert_buffer->flush(); + } +} diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index d0c4c6961b3..6a0e0ee239d 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -81,8 +81,6 @@ {{ Icon('font', 'square-facebook', '', true, 'fab contact-icon c-facebook-icon') }} {% elseif contact.ID == 'phpbb_twitter' %} {{ Icon('font', 'square-x-twitter', '', true, 'fab contact-icon c-twitter-icon') }} - {% elseif contact.ID == 'phpbb_skype' %} - {{ Icon('font', 'skype', '', true, 'fab contact-icon c-skype-icon') }} {% elseif contact.ID == 'phpbb_youtube' %} {{ Icon('font', 'youtube', '', true, 'fab contact-icon c-youtube-icon') }} {% else %} diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index d974ef334bb..774021f03db 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -204,8 +204,6 @@

{POLL_ {{ Icon('font', 'square-facebook', '', true, 'fab contact-icon c-facebook-icon') }} {% elseif postrow.contact.ID == 'phpbb_twitter' %} {{ Icon('font', 'square-x-twitter', '', true, 'fab contact-icon c-twitter-icon') }} - {% elseif postrow.contact.ID == 'phpbb_skype' %} - {{ Icon('font', 'skype', '', true, 'fab contact-icon c-skype-icon') }} {% elseif postrow.contact.ID == 'phpbb_youtube' %} {{ Icon('font', 'youtube', '', true, 'fab contact-icon c-youtube-icon') }} {% else %} diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 711963f54ff..3e76a316ceb 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -304,10 +304,6 @@ a:hover .icon.icon-black, /* DEPRECATED 4.0 */ color: #000000; } -.c-skype-icon { - color: #00aff0; -} - .c-youtube-icon { color: #ff0000; } diff --git a/tests/functional/ucp_profile_test.php b/tests/functional/ucp_profile_test.php index f8ac77cfae4..d422bf9a388 100644 --- a/tests/functional/ucp_profile_test.php +++ b/tests/functional/ucp_profile_test.php @@ -28,7 +28,6 @@ public function test_submitting_profile_info() $form = $crawler->selectButton('Submit')->form(array( 'pf_phpbb_facebook' => 'phpbb', 'pf_phpbb_location' => 'Bertie“s Empire', - 'pf_phpbb_skype' => 'phpbb.skype.account', 'pf_phpbb_twitter' => 'phpbb_twitter', 'pf_phpbb_youtube' => 'user/phpbb.youtube', )); @@ -41,7 +40,6 @@ public function test_submitting_profile_info() $this->assertEquals('phpbb', $form->get('pf_phpbb_facebook')->getValue()); $this->assertEquals('Bertie“s Empire', $form->get('pf_phpbb_location')->getValue()); - $this->assertEquals('phpbb.skype.account', $form->get('pf_phpbb_skype')->getValue()); $this->assertEquals('phpbb_twitter', $form->get('pf_phpbb_twitter')->getValue()); $this->assertEquals('user/phpbb.youtube', $form->get('pf_phpbb_youtube')->getValue()); diff --git a/tests/migrations/fixtures/remove_defunct_profilefields.xml b/tests/migrations/fixtures/remove_defunct_profilefields.xml new file mode 100644 index 00000000000..e37a86c3d2b --- /dev/null +++ b/tests/migrations/fixtures/remove_defunct_profilefields.xml @@ -0,0 +1,108 @@ + + + + field_id + field_name + field_ident + field_active + field_type + field_order + + 1 + phpbb_icq + phpbb_icq + 0 + profilefields.type.string + 1 + + + 2 + phpbb_yahoo + phpbb_yahoo + 0 + profilefields.type.string + 2 + + + 3 + phpbb_skype + phpbb_skype + 1 + profilefields.type.string + 3 + + + 4 + phpbb_youtube + phpbb_youtube + 1 + profilefields.type.string + 4 + +
+ + field_id + lang_id + option_id + field_type + lang_value + + 3 + 1 + 0 + profilefields.type.string + Skype + +
+ + field_id + lang_id + lang_name + lang_explain + lang_default_value + + 1 + 1 + ICQ + + + + + 2 + 1 + YAHOO + + + + + 3 + 1 + SKYPE + + + + + 4 + 1 + YOUTUBE + + + +
+ + lang_id + lang_iso + lang_dir + lang_english_name + lang_local_name + lang_author + + 1 + en + en + British English + British English + phpBB Limited + +
+
diff --git a/tests/migrations/remove_defunct_profilefields_test.php b/tests/migrations/remove_defunct_profilefields_test.php new file mode 100644 index 00000000000..4df50266379 --- /dev/null +++ b/tests/migrations/remove_defunct_profilefields_test.php @@ -0,0 +1,101 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use phpbb\db\migration\data\v400\remove_defunct_profilefields; + +class phpbb_migrations_remove_defunct_profilefields_test extends phpbb_database_test_case +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var remove_defunct_profilefields */ + protected $migration; + + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/remove_defunct_profilefields.xml'); + } + + protected function setUp(): void + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + $this->db = $this->new_dbal(); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->new_doctrine_dbal()); + $db_tools->set_table_prefix('phpbb_'); + + $this->migration = new remove_defunct_profilefields( + new \phpbb\config\config([]), + $this->db, + $db_tools, + $phpbb_root_path, + $phpEx, + 'phpbb_', + [] + ); + } + + public function test_delete_and_recreate_custom_profile_field_data() + { + $this->migration->delete_custom_profile_field_data(); + + $sql = 'SELECT field_name + FROM ' . PROFILE_FIELDS_TABLE . ' + ORDER BY field_id'; + $result = $this->db->sql_query($sql); + $this->assertEquals([['field_name' => 'phpbb_youtube']], $this->db->sql_fetchrowset($result)); + $this->db->sql_freeresult($result); + + $sql = 'SELECT COUNT(field_id) AS num_rows + FROM ' . PROFILE_LANG_TABLE . ' + WHERE field_id <> 4'; + $result = $this->db->sql_query($sql); + $this->assertEquals(0, (int) $this->db->sql_fetchfield('num_rows')); + $this->db->sql_freeresult($result); + + $sql = 'SELECT COUNT(field_id) AS num_rows + FROM ' . PROFILE_FIELDS_LANG_TABLE; + $result = $this->db->sql_query($sql); + $this->assertEquals(0, (int) $this->db->sql_fetchfield('num_rows')); + $this->db->sql_freeresult($result); + + // Deleting again must not fail when the fields are already gone + $this->migration->delete_custom_profile_field_data(); + + // Reverting recreates the fields with their language rows + $this->migration->create_custom_fields(); + + $sql = 'SELECT field_name, field_is_contact + FROM ' . PROFILE_FIELDS_TABLE . ' + ORDER BY field_order'; + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + $this->assertEquals( + ['phpbb_youtube', 'phpbb_icq', 'phpbb_yahoo', 'phpbb_skype'], + array_column($rows, 'field_name') + ); + + $sql = 'SELECT lang_name + FROM ' . PROFILE_LANG_TABLE . ' + WHERE field_id <> 4 + ORDER BY field_id'; + $result = $this->db->sql_query($sql); + $this->assertEquals(['ICQ', 'YAHOO', 'SKYPE'], array_column($this->db->sql_fetchrowset($result), 'lang_name')); + $this->db->sql_freeresult($result); + } +}