From 5a76b36dfb7b2144e63cef51042c5b60fc049ac0 Mon Sep 17 00:00:00 2001 From: Stanislav Atanasov Date: Thu, 26 Jun 2014 11:28:52 +0300 Subject: [PATCH 1/3] [ticket/12771] Bug in profilefield_base_migration when used in ext The base migration class should create lang entry for the new CPF but it is supposed to strip it of phpbb_ prefix. As extensions CPFs do not use phpbb_ prefix it will not create a lang entry. This is as simple solution as it can be done. PHPBB3-12771 --- phpBB/phpbb/db/migration/profilefield_base_migration.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index 9cdd5d0927..7927154ded 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -79,12 +79,13 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration $sql = 'SELECT lang_id FROM ' . LANG_TABLE; $result = $this->db->sql_query($sql); + $field_name = (substr($this->profilefield_name, 6) == 'phpbb_') ? strtoupper(substr($this->profilefield_name, 6)) : strtoupper($this->profilefield_name); while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) { $insert_buffer->insert(array( 'field_id' => $field_id, 'lang_id' => $lang_id, - 'lang_name' => strtoupper(substr($this->profilefield_name, 6)),// Remove phpbb_ from field name + 'lang_name' => $field_name, 'lang_explain' => '', 'lang_default_value' => '', )); From c14db9ccd088a5b5cccf2ffb1cc4b1d5abd6ed89 Mon Sep 17 00:00:00 2001 From: Stanislav Atanasov Date: Thu, 26 Jun 2014 14:19:49 +0300 Subject: [PATCH 2/3] [ticket/12771] Change var name Change var name PHPBB3-12771 --- phpBB/phpbb/db/migration/profilefield_base_migration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index 7927154ded..73bb674e5e 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -79,13 +79,13 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration $sql = 'SELECT lang_id FROM ' . LANG_TABLE; $result = $this->db->sql_query($sql); - $field_name = (substr($this->profilefield_name, 6) == 'phpbb_') ? strtoupper(substr($this->profilefield_name, 6)) : strtoupper($this->profilefield_name); + $lang_name = (substr($this->profilefield_name, 6) == 'phpbb_') ? strtoupper(substr($this->profilefield_name, 6)) : strtoupper($this->profilefield_name); while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) { $insert_buffer->insert(array( 'field_id' => $field_id, 'lang_id' => $lang_id, - 'lang_name' => $field_name, + 'lang_name' => $lang_name, 'lang_explain' => '', 'lang_default_value' => '', )); From deb393bff3d829b6531dd8ef18023e41f8d3357c Mon Sep 17 00:00:00 2001 From: Stanislav Atanasov Date: Thu, 26 Jun 2014 20:56:00 +0300 Subject: [PATCH 3/3] [ticket/12771] Shanging substr to strpos Logical change ... PHPBB3-12771 --- phpBB/phpbb/db/migration/profilefield_base_migration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index 73bb674e5e..d416a9b228 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -79,7 +79,7 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration $sql = 'SELECT lang_id FROM ' . LANG_TABLE; $result = $this->db->sql_query($sql); - $lang_name = (substr($this->profilefield_name, 6) == 'phpbb_') ? strtoupper(substr($this->profilefield_name, 6)) : strtoupper($this->profilefield_name); + $lang_name = (strpos($this->profilefield_name, 'phpbb_') === 0) ? strtoupper(substr($this->profilefield_name, 6)) : strtoupper($this->profilefield_name); while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) { $insert_buffer->insert(array(