3

I'm not sure why, but I am having extreme problems with several modules, but most noticeably, the signup module. The problems that I am having are sudden, and were not there yesterday, so I know it isn't a problem with the design of the module. I have tried patches, but those have caused other problems. Then it occurred to me: why should I have to do anything like that? Shouldn't there be a way to "hard-reset" a module? (ie remove the module and any remnance of it from the drupal database, and start from scratch as if the module was never installed in the first place, and then go and reinstall it) I have tried uninstalling it, deleting the module files, and the re downloading it and enabling it, but I get the same errors when I enable it again. How can I be delete it as if it was never there to begin with so I can start with a clean slate?

7

This answer reflects my understanding of how Drupal is working. Anyone with more or different understanding, please speak up, I'd love to know more.

Removing all remnants of a module by uninstalling it works only as well as the code included by the module for cleaning up after itself. For instance, if it has made a change such as adding tables or otherwise changing the database and does not properly delete the tables, they will remain there. Removing the module, should remove much of its potential to cause a problem provided that Drupal core knows it is gone and does not hang up looking for hooks that the module provided. Have you run 'update.php' in the URL? This will cause Drupal to update all the connections to the module. If the module is gone, then it won't make calls to it that cannot be responded to.

The only way to really reset Drupal is to maintain backups. Make backups before installing any module and at least every day or so during site development. The module Backup and Migrate is a simple way to simplify site database backups. In addition, it is also a good idea to look into using Git to keep track of your code when developing a site. Git is basically a unix tool, but there are windows UI versions such as GitGui that are not difficult to learn and put to work keeping track opf your code.

  • 1
    Great summary. I think (in no way attempting to bait other respondents) that ANY muddling in the database without Drupal 'knowing' is problematic.It's understandably the 'easiest' route sometimes, especially in a pinch - but as you said : backups are the only 'real' way. – Jake The Dweeb Feb 27 '12 at 15:04
  • For anyone looking for Windows friendly Git tools I highly recommend sourcetreeapp.com or windows.github.com - Both are excellent and very well developed. Cheers. – Mario Awad Aug 24 '13 at 8:45
4

Based on your comment referencing the error below, I don't think a hard reset will help:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'masada_drupal.field_data_field_date' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT n.nid AS nid, n.title AS title, n.type AS type, s.status AS signup_status, s.close_signup_limit AS signup_close_signup_limit, 1 AS expression FROM {node} n INNER JOIN {signup} s ON s.nid = n.nid LEFT OUTER JOIN {signup_log} s_l ON s.nid = s_l.nid LEFT OUTER JOIN {field_data_field_date} d ON d.entity_id = n.nid GROUP BY nid, title, type, signup_status, signup_close_signup_limit) subquery; Array ( ) in PagerDefault->execute() (line 74 of /var/www/masadatactical.com/htdocs/includes/pager.inc)

This seems to be a known bug for the D7 port of the signup module. There is a patch in the first comment that may help.


To answer your question regarding how to 'hard reset' a module:

In a perfect world, I believe disabling the module and then uninstalling (not deleting) it will be equivalent to a 'hard-reset'.

Once 'un-installed' simply re-enable the module and you're done.

Given that it's not a perfect world, you may need to look in your DB for tables that were not properly 'uninstalled' and remove them manually.

I would recommend making a DB backup before you start deleting modules or tables.

You may want to search for known uninstall bugs for the signup module first.

  • how do I get into db tables? – Ephraim Feb 27 '12 at 4:08
  • when I installed that patch the only user that is now able to view signups is the administrator role, regardless of user permissions (also the signups tab is gone) – Ephraim Feb 27 '12 at 4:27
  • There seem to be quite a few major bugs for the D7 port. drupal.org/project/issues/… Is there a permission (at admin/people/permissions) for authenticated users? – Citricguy Feb 27 '12 at 4:33
  • yes, and in fact what I found so strange was that I set it so that a role that I created called "page admin" could view, and administer all signups, however when a "page admin" user is logged in, and goes to [content]/signups, it gives them an access denied error, however when they go to [content]/signups/admin, they are able to change settings and everything. Just not view the signups... – Ephraim Feb 27 '12 at 4:35
1

The easiest way is to use drush and re-install the module, either by using Devel command:

drush -y dre foo

or using the standard way:

drush -y dis foo && drush -y pm-uninstall foo && drush -y en foo

You don't have you remove any files.

0

Did you actually uninstall the module or just disable it?

There is a tab on the Modules page called "uninstall." after you disable a module, you have to visit this tab to run the actual uninstall script for the module. If the module is build properly, this uninstall script will remove any trace of the module from the database.

  • yes, I actually uninstalled it. But when I re-enabled it, I got the same error when going to the admin/people/signup page – Ephraim Feb 27 '12 at 4:03
  • Your question is asking if there is a way to "hard-reset" a module. Uninstalling is the "hardest" way to reset a module. If you need help troubleshooting issues with a specific module, then you should provide more details about that exact issue and a clear question for people to answer. – sheena_d Feb 27 '12 at 4:07
  • What error are you seeing specifically? – Citricguy Feb 27 '12 at 4:07
  • @Citricguy The error is the full page of admin/people/signup. It won't allow me to see any of the listed signups. the actual text is as follows: – Ephraim Feb 27 '12 at 4:11
  • PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'masada_drupal.field_data_field_date' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT n.nid AS nid, n.title AS title, n.type AS type, s.status AS signup_status, s.close_signup_limit AS signup_close_signup_limit, 1 AS expression FROM {node} n INNER JOIN {signup} s ON s.nid = n.nid LEFT OUTER JOIN {signup_log} s_l ON s.nid = s_l.nid LEFT OUTER JOIN {field_data_field_date} d ON d.entity_id = n.nid GROUP BY – Ephraim Feb 27 '12 at 4:11
0

I had similar problem with another module. Problem lied in some of the data that was stored in one of the Database tables of the module itself.

Hard resetting a module generally implies installing it afresh with default data in its tables. In Drupal-7, many modules provide methods to completely uninstall them by removing their database tables. This can be done by going to admin/modules/uninstall. After uninstalling it from here, you can re-install it and it will all new.

However, most modules don't provide this functionality. In that case, you will have to take slight risk by deleting the appropriate tables from the database. Just take a backup before going for the kill. Deleting the tables has worked just fine for me, in many instances. But let me warn you again. It is risky. After doing the deletion, check your site thoroughly if it's broken somewhere.

A better for doing manual deletion is to go look into the code of the module, and see which tables it has created. And then, delete the corresponding tables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.