We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Uninstalling module fires FT `settings_modify_column`

Developer Preview

Jace Richardson's avatar
Jace Richardson
13 posts
7 years ago
Jace Richardson's avatar Jace Richardson

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

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.