How to Reinstall a Magento Module

Spread the love

Sometimes, we need troubleshooting an installed Magento Module, which you know should work perfectly, but in your case, it is not.

Doing a reinstall seems to be an option. If you installed the module using Magento connect, it is straightforward, everything can be handled via Magento back-end. However, if we installed the module manually, you will find not easy to do so.

Re-upload and Overwrite All Module Files

Replacing all files from the module may resolve the issue in the case that the issue was caused by corrupted or missing files. However, this will do nothing to the database. The existing tables and records in the database will not be updated.

Run the Database Install Script

In case something wrong with your database, e.g. dependent tables were not created in the initial install process.
We want the database install script of your module to run another time.
In order to do so, we will need to delete the setup record for your module in the database. Find the setup record in the core_resource table, it should look like yourmodule_setup(see the example below). Delete it with the SQL statement below, or use phpMyAdmin.

Magento core_resource table

Delete Statement:

When Magento scans file system, and find this module. Without having a setup record in the core_resource table, Magento will treat it as a new module and then run the database setup script.

However, you may also consider deleting all the dependent tables of that plugin in the database before trying re-run the script. Because the script usually uses CREATE TABLE IF NOT EXISTS statement. So it only creates the tables if it doesn’t exist before.

Clean Module Configuration

Last, if you have gone through the two steps above, and still no luck. You may try resetting the configuration of the module saved in Magento too.
These configuration usually store in the core_config table. To find all records belong to the module, open the system.xml file of your module(etc/system.xml) and match the fields defined here with records in core_config table. See an example below

Field ‘Active’ defined in system.xml

Magento module system.xml

Record ‘mailchimp/general/active’ in core_config table

Magento core_config table

Delete all records that added by this module, and the re-do the first two steps. Then you have completed the module reinstall.

 

Leave a Reply

Your email address will not be published. Required fields are marked *