Page MenuHomePhabricator

OutputPageBeforeHTML hook is not executed for preview
Closed, ResolvedPublic

Description

Author: ross

Description:
As described in the 1.6 release notes, the OutputPageBeforeHTML hook was
designed "to postprocess article HTML on page view (comes after parser cache, if
used)." It therefore seemed ideal for the design of extensions that produce
rapidly-changing output, since producing it at this late stage would not affect
the page cache. However, according to Brion Vibber, this hook is not triggered
when loading Squid-cached content
([http://uncyclopedia.org/wiki/Forum:Getting_the_current_user's_username#Alternative],
[http://meta.wikimedia.org/wiki/Talk:UserMagic]). Additionally, the hook is not
triggered when viewing a page in Preview mode
[http://www.undefined.net/w/index.php?title=Test]. These limitations severely
hamper the usefulness of this hook in extension writing, and should be removed.


Version: 1.8.x
Severity: normal
URL: http://meta.wikimedia.org/wiki/UserMagic

Details

Reference
bz7050

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:24 PM
bzimport set Reference to bz7050.
bzimport added a subscriber: Unknown Object (MLST).

wilson.jim.r wrote:

These limitations severely hamper the usefulness of this hook in extension

writing, and should be removed.

Please don't. OutputPageBeforeHTML offers one of the only ways an extension
developer can inject raw HTML into a page uninhibited by the Parser as of
versions 1.6.9, 1.8.3 and 1.9.2.

ayg wrote:

(In reply to comment #0)

However, according to Brion Vibber, this hook is not triggered
when loading Squid-cached content

([http://uncyclopedia.org/wiki/Forum:Getting_the_current_user's_username#Alternative],

[http://meta.wikimedia.org/wiki/Talk:UserMagic]).

INVALID. Squid is written in C and could not possibly execute PHP hooks. Cache
hits won't touch MediaWiki at all. If Squid has a hook architecture, you can
use that to write extensions for it, otherwise you have to ask them to add the
hooks. We don't control Squid.

Additionally, the hook is not
triggered when viewing a page in Preview mode
[http://www.undefined.net/w/index.php?title=Test].

That's something we can fix (if it's still true).

(In reply to comment #1)

These limitations severely hamper the usefulness of this hook in extension

writing, and should be removed.

Please don't. OutputPageBeforeHTML offers one of the only ways an extension
developer can inject raw HTML into a page uninhibited by the Parser as of
versions 1.6.9, 1.8.3 and 1.9.2.

The suggestion was to apply the hook in more places (i.e., remove restrictions
on when the hook is run), not to remove it.