Someone able to document the upgrade path for if (!$may_cache) { } , please. This have been used to run code exactly once per page view without using hook_init that is not supported with aggressive cache mode.

CommentFileSizeAuthor
#3 system_init.patch1.41 KBhass

Comments

chx’s picture

Status: Active » Fixed

hook_init is split into hook_init (the old !$may_cache) and hook_boot (this runs even for cached pages).

hass’s picture

Component: menu system » system.module
Category: task » bug
Status: Fixed » Active

And the new hook_init is not incompatible with aggressive mode caching and will function properly?

If so the following text and code need to be updated (admin/settings/performance in systems.module) to reflect this change:

old:

  $problem_modules = array_unique(array_merge(module_implements('init'), module_implements('exit')));

should be changed to

  $problem_modules = array_unique(array_merge(module_implements('boot'), module_implements('exit')));

and text

The normal cache mode is suitable for most sites and does not cause any side effects. The aggressive cache mode causes Drupal to skip the loading (init) and unloading (exit) of enabled modules when serving a cached page. This results in an additional performance boost but can cause unwanted side effects.

changed into

The normal cache mode is suitable for most sites and does not cause any side effects. The aggressive cache mode causes Drupal to skip the loading (boot) and unloading (exit) of enabled modules when serving a cached page. This results in an additional performance boost but can cause unwanted side effects.

hass’s picture

Status: Active » Needs review
StatusFileSize
new1.41 KB

patch attached

hass’s picture

Aside, are you able to document the above on the modules update page, please.

gábor hojtsy’s picture

Chx, please do document the !$may_cache to hook_init change in the update docs (not only in the comments). Also it would be nice to double check, whether there are any other places additionaly to what hass noted where this change should be reflected in core.

hass’s picture

Title: modules upgrade path for !$may_cache from D5? » rename prior hook_init strings to hook_boot in core
gábor hojtsy’s picture

Status: Needs review » Needs work

Although there was no independent review here unfortunately, as far as I see, this is how things changed, so committed the patch. Thanks! Still needs to be documented, so setting to "needs work" as usual.

moshe weitzman’s picture

Status: Needs work » Fixed

already documented on module upgrade: http://drupal.org/node/114774#hook-boot-init. api docs are done too - http://api.drupal.org/api/function/hook_boot/6 (minor nit: the 'see also' should be a link)

Anonymous’s picture

Status: Fixed » Closed (fixed)