views:

24

answers:

1

One of my developers wanted to override some functionality of the core user module. He made a copy of the core user module and placed it in the sites/all/modules folder. Something in the functionality screwed up and now I am not sure how to uninstall it. I have tried deleting the module from the sites/all/modules folder and it now crashes the site. I then edit the systems table to make sure all entries point to the original user module but now I have problems with the user module and weird anomalies. Is it a bad practice to override core modules? Are there any other tables that need to be cleaned? What is a sure shot way of removing a module which cannot be removed via Admin control panel as in this case the overriden user module never appears in the module list.

+3  A: 

Is it a bad practice to override core modules?

Yes. Do not override core modules: Bad Things (like what you have now) happen.

Are there any other tables that need to be cleaned?

This is impossible to tell without knowing the code in your version of the user module, but even knowing it the damage has already been done.

What is a sure shot way of removing a module which cannot be removed via Admin control panel as in this case the overriden user module never appears in the module list.

Normally, if you can't access the module administration page for whatever reason, you'd run the following to uninstall the module:

module_load_install($module);
$versions = drupal_get_schema_versions($module);
drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED);
module_invoke($module, 'uninstall');

Then delete the overriding module's files and re-install the original module. You have to delete the files after running the uninstall hooks because the files contain the code that needs to be performed during the uninstall.

However, since you've overridden the user module, you're in a really bad place, as you can't uninstall the user module: required core modules are not meant to be tampered with.

So, the surefire way to get out of the mess you're currently in is to delete the overriding module and restore from a previous database backup.

Mark Trapp
Mrk, thanks again for the detailed answer. You have on several occasions helped me in my endeavors with Drupal. Thanks so much for your feedback.
jini

related questions