At http://drupal.org/node/55554 I have been looking into a content.module installation issue. Database errors are being thrown about missing tables, even though the tables are indeed created. I believe the following is happening:

1) User enables module
2) Drupal marks module as enabled
3) The menu system asks the module for its menus
4) The install hook is invoked and tables are created

The problem is that step 3 invokes the module's menu hook, which in this case performs a call to the database. This is not entirely unusual; several modules build their menus using the database. But the tables do not exist until step 4. I propose we invert these two operations, so no module code is run before the install hook has a chance to fire.

The patch to do this is attached. Is there any reason the menus need to be up to date before the install hook is fired?

CommentFileSizeAuthor
install_11.patch717 bytesJonBob
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Zen’s picture

Status: Needs review » Reviewed & tested by the community

Patched and tested with a fresh install of a couple of modules. No issues noted during the install and no errors in the watchdog. Menus appeared fine.

Placing 4) before 3) (as per JonBob's post) also mimics how modules behave with manually installed tables. Moreover, it looks like the current system will also not immediately display menu items added via the install file.

Setting to RTC.

-K

killes@www.drop.org’s picture

Status: Reviewed & tested by the community » Fixed

applied

Anonymous’s picture

Status: Fixed » Closed (fixed)