currently modules can inadvertently load all other modules during the bootstrap. this is easy to do by calling a node_load() or module_invoke_all(). this degrades performance for anonymous users when caching is enabled.

with this patch, the module writer will see an php error like "Call to undefined function: drupal_set_html_head()" if this is attempted. basically, unavailable functions are actually reported as unavailable. this patch is only 1 line long, and probably worthy of 4.6 consideration. If it goes in for 4.7, that would be OK with me too.

in order to test this patch, you could view a cached page as anonymous when an offending modeule is enabled (e.g. sections.module, taxonomy_context.module, etc.). I will help fix all these modules after this patch is accepted.

CommentFileSizeAuthor
module_list.patch1.02 KBmoshe weitzman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

Just in case someone thinks this isn't a significant problem, have a look at this scan of the Contrib repos. Some of these modules are not breaking the bootstrap, but sure many are.

grep -rnl "_init(" *
amazonsearch/amazon_search.module
amazontools/amazon.inc
amazontools/amazon.php4.inc
amazontools/amazon.php5.inc
attached_node/attached_node.module
authorise/patches/tree.patch
blogtheme/blog_theme.module
contextlinks/CHANGELOG.txt
devel/devel.module
ecommerce/contrib/authorize_net/authorize_net.module
filestore2/filestore2.module
gallery/gallery.module
groups/groups.module
htmlarea/plugins/UploadDocuments/popups/insert_link.php
htmlarea/plugins/UploadImage/popups/insert_image.php
htmltidy/htmltidy.module
i18n/i18n.inc
i18n/i18n.module
i18n/patches/i18n_drupal_goto.patch
i18n/patches/i18n_language_variables.patch
jsdomenu/jsdomenu.module
ldap_integration/ldap_integration.module
massmailer/engines/phplist/config.php
media/media.module
node_aggregator/feed.module
nodewords/nodewords.module
over_text/over_text.module
paypal_framework/paypal_framework.module
quicktags/quicktags.module
recorder/recorder.module
ride/ride.module
sections/README.txt
sections/sections.module
shoutbox/shoutbox.module
taxonomy_assoc/taxonomy_assoc.module
taxonomy_context/taxonomy_context.module
theme_editor/theme_editor_engine.engine
troll/troll.module
weblink/weblink.module
webserver_auth/webserver_auth.module
Prometheus6’s picture

For the record:

amazonsearch/amazon_search.module
amazontools/amazon.inc
amazontools/amazon.php4.inc
amazontools/amazon.php5.inc

You can take these off the list.

Dries’s picture

I like this patch. Committed to HEAD for inclusion in Drupal 4.6! I'm marking this 'active' until the modules have been fixed.

moshe weitzman’s picture

Status: Active » Fixed

modules that misuse this hook simply won't work anymore. marking this as fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)
TomChiverton’s picture

Version: » 4.6.5

I will help fix all these modules after this patch is accepted.
If I'm right at figuring out what is up, any chance of fixing quicktags (http://drupal.org/node/16826) for 4.5(.7) ?