[ticket/12786] Add clean_cpf_db_entries

Add function to clean the cpf fields entries

PHPBB3-12786
This commit is contained in:
Stanislav Atanasov 2014-06-29 16:28:57 +03:00
parent 52204e0e6d
commit 18631801d5

View file

@ -141,6 +141,29 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
$insert_buffer->flush(); $insert_buffer->flush();
} }
/**
* 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 * Get custom profile field id
* @return int custom profile filed id * @return int custom profile filed id