For some reason this gives you a "undefined function" error if you install optionwidget module and content.module at the same time. If you install first content.module and then optionwidget.module, it works.

Comments

yched’s picture

Right, all those content_notify functions should be wrapped in an include_once('content.module')...

yched’s picture

Right, all those content_notify functions should be wrapped in an include_once('content.module')...

KarenS’s picture

I just ran into this while trying to debug another update problem. It turns out the content module is one of the last to be installed, even though it is first alphabetically. The fieldgroup module is one of the first to install even though it has a weight of 9 and the others are zero. We should do something about fixing the update order in D7...

KarenS’s picture

And now that modules are updated even if they are disabled, it will not matter which you install first, the updates will run on everything in the modules folder the first time you visit the update page, so all the core CCK fields will get updated at once. In fact, it's odd you saw any difference, unless you physically removed optionwidgets from the modules folder, or didn't put it there in the first place.

yched’s picture

content module is one of the last to be installed
to be installed ? or to be updated ?

Killes initial report is not in an update context. It was from a fresh install, when enabling content and optionwidgets at the same time.
In such a case (module dependency), I'd expect core to install the dependency first (content) ?
But even if content is enabled first, I guess content.module does not get loaded by the time optionwidgets_enable() is run...

yched’s picture

OK, after actually checking :
Core does load .modules files right after enabling them, but does not ensure dependency order...
My first impression would be this is a core bug ?

KarenS’s picture

I was talking about updating not installing. It wasn't completely clear in the post which it was. The bizarre order is happening in the update process. A patch went into core that is supposed to install modules in dependency order, and they are enabled after they are installed, so it's odd that the content module was not available by the time optionwidgets was installed.

Obviously we can't count on anything so we should include_once() in all the functions on the install page.

But instead of adding it to every function, would it be better to just include it one time at the top of the install file?

KarenS’s picture

Here's the commit that was supposed to ensure modules installed in dependency order http://drupal.org/cvs?commit=91237.

yched’s picture

er, you're right of course, and I overlooked that part. Modules are indeed supposed to be installed in the right order. Mmmh.
So we shouldn't need the includes in the first place ?

KarenS’s picture

Status: Active » Fixed

I just went back and added watchdog entries to the install code to log what order things happen in, and they install in the right order, content module first, number, text, and optionwidgets next (they have other modules that depend on them) and then everything else. And all modules are enabled after they are installed.

So it's a mystery why we should need to include anything, but apparently we must.

I also did some testing to see if it works to just include it once at the top of the .install file instead of over and over in every function, and it seems to, so I've committed that change.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.