When uninstalling an add-on, the EE uninstaller fires the uninstall()
method in the add-on’s UPD file first and then uninstalls the add-on’s fieldtype which fires the settings_modify_column
method.
The settings_modify_column
method has code that if the $data['ee_action'] == 'delete'
, it removes data from the add-on’s custom tables but because the add-on has already been uninstalled, the custom tables no longer exist and the uninstall dies out with a “Base table or view not found” error.
I’ve temporarily rectified this by wrapping the delete code in the settings_modify_column
with a conditional to check if our custom table exists but in order to do this, I also have to wipe out the DB cache of table names because it hasn’t been updated since the module was uninstalled:
else if ($data['ee_action'] == 'delete')
{
// Clear the DB table name cache.
if(isset(ee()->db->data_cache['table_names'])) unset(ee()->db->data_cache['table_names']);
if(ee()->db->table_exists('assets_selections')) {
// delete any asset associations created by this field
ee()->db->where('field_id', $data['field_id'])
->delete('assets_selections');
}
}
So that means that every time the settings_modify_column
is called with a delete
action, I’m wiping out the EE DB table cache and checking if my table exists (which feels sloppy).
Here is a screenshot of the stacktrace
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.