From e3b07274ef514906920006104604b7d43284bf9c Mon Sep 17 00:00:00 2001 From: Stanislav Atanasov Date: Sun, 29 Jun 2014 11:51:47 +0300 Subject: [PATCH] [ticket/12786] Add create_language_entries Add function to create entries in PROFILE_FIELDS_LANG_TABLE PHPBB3-12786 --- .../migration/profilefield_base_migration.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index 31244bf957..f96495d2df 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -111,6 +111,36 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration $insert_buffer->flush(); } + /** + * Create Custom profile fields languguage entries + */ + public function create_language_entries() + { + $field_id = $this->get_custom_profile_field_id(); + + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_FIELDS_LANG_TABLE); + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE; + $result = $this->db->sql_query($sql); + while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) + { + foreach ($this->profilefield_language_data as $language_data) + { + $insert_buffer->insert(array( + 'field_id' => $field_id, + 'lang_id' => $lang_id, + 'option_id' => $language_data['option_id'], + 'field_type' => $language_data['field_type'], + 'lang_value' => $language_data['lang_value'], + )); + } + } + $this->db->sql_freeresult($result); + + $insert_buffer->flush(); + } + /** * Get custom profile field id * @return int custom profile filed id