diff options
author | Stanislav Atanasov <lucifer@anavaro.com> | 2014-06-29 16:28:57 +0300 |
---|---|---|
committer | Stanislav Atanasov <lucifer@anavaro.com> | 2014-06-29 16:29:09 +0300 |
commit | 18631801d53a3631a928a32d79695d3486d40ca0 (patch) | |
tree | 4b25dfd8be77e40d4078dbf71f6189b8e21bb2e3 | |
parent | 52204e0e6dc3119be54df28f12cf39b7116830e0 (diff) | |
download | forums-18631801d53a3631a928a32d79695d3486d40ca0.tar forums-18631801d53a3631a928a32d79695d3486d40ca0.tar.gz forums-18631801d53a3631a928a32d79695d3486d40ca0.tar.bz2 forums-18631801d53a3631a928a32d79695d3486d40ca0.tar.xz forums-18631801d53a3631a928a32d79695d3486d40ca0.zip |
[ticket/12786] Add clean_cpf_db_entries
Add function to clean the cpf fields entries
PHPBB3-12786
-rw-r--r-- | phpBB/phpbb/db/migration/profilefield_base_migration.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index b2c0161286..e360de1d8e 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -142,6 +142,29 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration } /** + * Clean db after purging of extension + * function should be called from migration + * using revert_data() + */ + public function clean_cpf_db_entries() + { + $field_id = $this->get_custom_profile_field_id(); + + //Let's clean the field + //1. PROFILE_FIELDS_TABLE + $sql = 'DELETE FROM ' . PROFILE_FIELDS_TABLE . ' WHERE field_id = ' . $field_id; + $this->db->sql_query($sql); + + //2. PPROFILE_LANG_TABLE + $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' WHERE field_id = ' . $field_id; + $this->db->sql_query($sql); + + //3. PROFILE_FIELDS_LANG_TABLE + $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE field_id = ' . $field_id; + $this->db->sql_query($sql); + } + + /** * Get custom profile field id * @return int custom profile filed id */ |