Module Loading in a Different Order on Live Site Than in Dev Site
I ran into an issue yesterday where Hierarchical Select (along with Content Taxonomy and CCK) wasn't saving the data I selected. But this happened only after I switched my development site to go live.
I started back tracing through HS (hierachical select) and noticed it was looking for #field_info inside $form.... but it wasn't their. So then I checked CCK and noticed that it was being loaded way way after HS.
Then I checked weight... they had the same weight... confusing.
For those of you who don't know, drupal loads modules based on weight, then filename. So if CCK and HS have the same weight, CCK should be loaded then HS.
So in the end I finaly realized something, that drupal doesn't just look at the module filename, but looks at the folder location also. I am using multisite, so my modules are located in 2 different locations:
- in sites/all/modules <- these are for all my sites
- in sites/mysite.com/modules <- these are for site spacific
On my dev server my structure looked like:
- sites/all/module
- sites/dev-mysite.com/modules
On my live server it looked like:
- sites/all/modules
- sites/abcmysite.com/modules
Can you see the issue? On the dev site "a" in "all" comes before "d" in "dev-mysite". On the live site "a" in "abcmysite" comes before "a" in "all". So drupal was loading the modules from the multisite location before it was loading them from the all/ location. This caused CCK to get loaded after HS, giving me issues (because HS needs CCK to be loaded first.
Stupid thing that cost me 2.5 hours to notice.
Note - To help me figure this out I used this mysql command on both servers and compaired the output (thanks grobot in #drupal irc).
SELECT name, filename, throttle, weight, bootstrap, schema_version, type, owner FROM system WHERE TYPE = 'module' AND STATUS =1 ORDER BY weight ASC , filename ASC LIMIT 0 , 200
Post new comment