Drupal has an annoying "feature" which causes update hooks for disabled modules to be executed by update.php (or drush updb).
When using alternative search methods (apachesolr module), the search_api and panopoly_search modules are disabled.
However, when updates are run, panopoly_search update 7005 causes this error:
Fatal error: Call to undefined function search_api_index_load_multiple() in /opt/clients/demo.openatrium.com/drupal/profiles/openatrium/modules/panopoly/panopoly_search/panopoly_search.install on line 110
Drush command terminated abnormally due to an unrecoverable error.
In update hooks, always check to see module_exists before calling a module that might be disabled.
Comment | File | Size | Author |
---|---|---|---|
#11 | panopoly_search-update_hook_module_exists_check-2444359-11.patch | 3.53 KB | lunazoid |
#4 | panopoly_search-update_hook_module_exists_check-2444359-4.patch | 1.73 KB | caschbre |
Comments
Comment #1
caschbre CreditAttribution: caschbre commentedComment #2
dsnopekThanks, @caschbre!
Let's do
module_exists("panopoly_search")
rather than "search_api" - because that's really what this is about. We can't have "panopoly_search" enabled without "search_api" and reverting our Feature if our Feature isn't enabled isn't really going to help anything.Comment #3
caschbre CreditAttribution: caschbre commentedAh, ok... so have the module check if itself is enabled?
Comment #4
caschbre CreditAttribution: caschbre commentedComment #5
dsnopekYeah... Now that I know that Drupal runs update hooks for disabled modules, we should probably do an audit of our update hooks. I'll make an issue about it.
Comment #6
caschbre CreditAttribution: caschbre commentedYeah, I've never run across that issue before. Is there a d.o. issue somewhere on it? Might see what we can do to fix it there.
Comment #7
dsnopekHere's the new issue: #2445827: Audit hook_update_N() for assumption that the module is enabled
Comment #9
dsnopekPatch looks good, thanks! Committed.
Comment #11
lunazoid CreditAttribution: lunazoid as a volunteer commentedSorry to reopen this issue, but it seems like the place to put this. I just encountered this issue updating to Panopoly 1.27, as update hooks 7006 and 7007 didn't have the check in place. This patch adds it to those hooks as well.
Comment #12
dsnopekThanks for the patch! However, this should be a new issue to make it easy to dissect our git history later.