Over at the Block Group module I had a nasty problem with hook_info_alter sometimes not being called when theme-info was rebuilt during an early bootstrapping phase. See #1941246: Cache clears sometimes cause blocks to become disabled and af07f0c for a workaround.

Comments

upchuk’s picture

Status: Active » Needs work

Thanks znerol!

I will make the changes and add a hook_boot() as well.

Thanks for the catch!

upchuk’s picture

Status: Needs work » Patch (to be ported)
StatusFileSize
new444 bytes

I rolled a patch for this purpose if you want to apply it.
Let me know if there is anything else.

Thanks a lot for your help!

upchuk’s picture

StatusFileSize
new444 bytes

Sorry, I think there was a problem with the filename and I couldn't edit my earlier comment attachment which is weird..

znerol’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

I confirm that the fix you committed to the dev version works. FYI, my strategy for testing this was to create a new file inject-test.php next to the index.php within the drupal root directory.

inject-test.php:

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);

require_once DRUPAL_ROOT . '/includes/common.inc';
system_rebuild_theme_data();

Ensure the bug is present in stable:

  1. Then download and enable the stable version of Block Inject, create a new injected region, navigate to blocks administration page, ensure the injected region is there.
  2. Then execute inject-test.php
  3. After that verify that the injected region vanished from the block administration page.

Ensure that the bug is fixed in dev: Same procedure as above but use dev version. The injected region now should survive inject-test.php.

A minor note on the issue status: patch (to be ported) is used when a patch has been applied to one branch (e.g. 7.x-1.x) but still needs to be adapted for another branch (e.g. 6.x-1.x). See the handbook for more info.

znerol’s picture

Another note: The bootstrap-status of modules is only updated (using _system_update_bootstrap_status) when:

  1. A module is enabled or disabled
  2. The whole cache is flushed using drupal_flush_all_caches.

The latter is called from within update_finished. Because you already implemented an update-function in the other issue, you do not need to take additional actions to ensure that the bootstrap-status of the block inject module is correct.

upchuk’s picture

Cool,

Thanks for testing it out and letting me know. I will soon add a new release.

Also thank you for the tips on the status :)

There is one thing I do not fully understand though: I am a bit confused as to what you mean in comment #5.

Thanks!

znerol’s picture

The system table in the database has a field indicating whether modules should be loaded early during bootstrapping. This field is called bootstrap. A module is only loaded early if this bootstrap-field is set to 1.

Drupal decides whether this bootstrap-field should be set in the system-table when modules are enabled or disabled or after a database upgrade finished.

Because your module did not implement any bootstrap-hook (like hook_boot) before, it was not marked as a bootstrap-module in the system table in current installations. When you simply add a bootstrap-hook, the bootstrap-flag in the system table of the database is not automatically updated. Except on one of the occasions I mentioned above.

upchuk’s picture

Cool, thanks for the clarifications. So because in the other issue I added an update hook, when existing installations will update the module, the bootstrap flag will also be updated if I understood correctly :)

Cheers!

znerol’s picture

Exactly.

upchuk’s picture

Status: Reviewed & tested by the community » Fixed

Cool! Thanks

Status: Fixed » Closed (fixed)

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