From 526c79d2e239afbfbaee0a6d8222494c7ea6a0ff Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 1 Nov 2023 16:50:20 +0100 Subject: [PATCH 1/2] [ticket/17208] Skip profile field data update if youtube cpf doesn't exist PHPBB3-17208 --- .../db/migration/data/v33x/profilefields_update.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/phpBB/phpbb/db/migration/data/v33x/profilefields_update.php b/phpBB/phpbb/db/migration/data/v33x/profilefields_update.php index 73cd98353a..02fc8858f4 100644 --- a/phpBB/phpbb/db/migration/data/v33x/profilefields_update.php +++ b/phpBB/phpbb/db/migration/data/v33x/profilefields_update.php @@ -87,6 +87,12 @@ class profilefields_update extends \phpbb\db\migration\migration $yt_profile_field = 'pf_phpbb_youtube'; $has_youtube_url = $this->db->sql_like_expression($this->db->get_any_char() . 'youtube.com/' . $this->db->get_any_char()); + // We're done if the profile field doesn't exist + if (!$this->db_tools->sql_column_exists($profile_fields_data, $yt_profile_field)) + { + return true; + } + $update_aborted = false; $sql = 'SELECT user_id, pf_phpbb_youtube @@ -153,6 +159,13 @@ class profilefields_update extends \phpbb\db\migration\migration $this->db->sql_query($sql); $yt_profile_field = 'pf_phpbb_youtube'; + + // We're done if the profile field doesn't exist + if (!$this->db_tools->sql_column_exists($profile_fields_data, $yt_profile_field)) + { + return; + } + $prepend_legacy_youtube_url = $this->db->sql_concatenate( "'https://youtube.com/'", $yt_profile_field ); From dd549a5e43b2bd146d1eea9cb299ce9429ca27ae Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 1 Nov 2023 16:54:19 +0100 Subject: [PATCH 2/2] [ticket/17208] Ensure to not run the previous migration with missing column PHPBB3-17208 --- .../db/migration/data/v33x/profilefield_youtube_update.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/phpbb/db/migration/data/v33x/profilefield_youtube_update.php b/phpBB/phpbb/db/migration/data/v33x/profilefield_youtube_update.php index fc7cc5b4f7..025907afa2 100644 --- a/phpBB/phpbb/db/migration/data/v33x/profilefield_youtube_update.php +++ b/phpBB/phpbb/db/migration/data/v33x/profilefield_youtube_update.php @@ -71,6 +71,12 @@ class profilefield_youtube_update extends \phpbb\db\migration\migration . $this->db->get_any_char() ); + // We're done if the profile field doesn't exist + if (!$this->db_tools->sql_column_exists($profile_fields_data, $yt_profile_field)) + { + return; + } + $this->db->sql_query( "UPDATE $profile_fields_data SET $yt_profile_field = $prepend_legacy_youtube_url