Fix that, please.

Comments

webchick’s picture

Title: PHP notice on admin/build/modules » PHP notice on admin/build/modules the first time it scans a new module
Status: Reviewed & tested by the community » Active

We dug a bit deeper in IRC about this, and it turns out this only occurs the first time the page is loaded that a new module is in there it doesn't know about yet.

As best we can tell, this happens because http://api.drupal.org/api/function/system_get_files_database/7 is querying the database, and there's no record of the module there yet.

So while sun's patch will mask the issue, it seems like there might be something deeper...

sun’s picture

Title: PHP notice on admin/build/modules the first time it scans a new module » PHP notice on admin/build/modules
Status: Active » Needs work
Issue tags: -Novice +Registry

Not RTBC.

http://api.drupal.org/api/function/system_get_files_database/7 is invoked to apply further properties to each module, but the registry does not know of new modules at this stage. So file_scan_directory() returns modules the registry doesn't know of yet.

Tagging.

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new725 bytes

We want to invoke system_get_module_data() here (once) to scan and update the available modules. Needs testing of the installer though.

damien tournoud’s picture

... but we also want to add a static of some sort to system_get_module_data() in order not to traverse the whole file tree twice in search of modules.

berdir’s picture

@4

Actually, we do it 3 times already :) (twice with system_get_module_data() and the registry does it directly to save update queries that we don't execute anymore).

I tried to implement the static cache in #147000-30: Rewrite module_rebuild_cache() and system_theme_data() already, but failed because simpletest had issues with that and I didn't wanted to delay that issue.

Status: Needs review » Needs work

The last submitted patch failed testing.

berdir’s picture

I changed the registry_rebuild() function in #429132: Remove unecessary module_rebuild_cache() call from _registry_rebuild(), now that we optimized system_get_module_data() (And will hopefully further improve it), we can revert that, I think. Not that you can also remove the ini file parsing stuff then.

berdir’s picture

StatusFileSize
new1.18 KB

Adding a static cache and getting the tests working seems to be hard, so I just reverted my patch in _registry_rebuild() for now.

berdir’s picture

StatusFileSize
new1.24 KB

That was the wrong patch...

berdir’s picture

Status: Needs work » Needs review

And now the correct status...

boombatower’s picture

Status: Needs review » Reviewed & tested by the community

Looks clean and fixes issue.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

I like the resulting code much better. I think according to Berdir in #7 that the performance hit isn't as great anymore, but I'm sure catch will inform us if that's not the case. ;)

Committed to HEAD!

Status: Fixed » Closed (fixed)
Issue tags: -Registry

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