[support] Where do files listed in *.info get loaded

Eric W. Bates ericx at ericx.net
Tue Dec 13 16:08:41 UTC 2011


Thanks to both of you. That's extremely helpful.

I'm trying to write my first entity and it's crashing when disabled 
because a class definition is not being loaded.

On 12/12/2011 6:21 PM, Jamie Holly wrote:
> The actual files get loaded when a hook is called with in them (see
> module_implements) or if they have a class inside of them. In the case
> of classes, it's the same thing as PHP's auto(lazy)loading of classes.
>
> They also get loaded when the cache is cleared so that the hook registry
> can be rebuilt.
>
> Jamie Holly
> http://www.intoxination.net
> http://www.hollyit.net
>
>
> On 12/12/2011 6:10 PM, Christian Lopez wrote:
>> On Mon, Dec 12, 2011 at 11:23 PM, Eric W. Bates<ericx at ericx.net>   wrote:
>>>   I'm sure this question has been asked, but I can't seem to phrase my
>>>   Google query to find it.
>>>
>>>   Where do the files listed in a module's .info file get loaded in Drupal 7?
>>>
>>>   The list gets written into the 'system' table's 'info' field; but I
>>>   can't figure out when/where list gets pulled and the files get loaded.
>>
>> It's loaded at _system_rebuild_module_data from core system module.
>> This is called by update_verify_update_archive at the core update
>> module, which implements hook_verify_update_archive.
>>
>> hook_verify_update_archive is called from update_manager_archive_verify.
>>
>> This method is called from:
>>
>> a) update_manager_install_form_submit.
>> b) update_manager_batch_project_get, called by
>> update_manager_update_form_submit.
>>
>> Those are called from
>> a) $module_path . '/install'
>> b) $module_path . '/update'
>>
>> So you can see that they are read when you try to install or update a module.
>>
>> PS: Of course, if any of those methods are called from non-core code,
>> they will trigger the read of the files section of the .info files.
>> P.e. drush_get_modules at drush calls system_rebuild_module_data
>> You can find references to system_rebuild_module_data in core at
>> help.module, field module... and in contrib files like coder or
>> features.
>>
>>
>> Hope this helps.
>>
>>>   Thanks for your time.
>>>   --
>>>   [ Drupal support list | http://lists.drupal.org/ ]
>>
>>
>>


More information about the support mailing list