Page MenuHomePhabricator

'BeforePageDisplay' hook is not being called in Extension:UsabilityInitiative r62695 with "Vector enhancements" turned on
Closed, ResolvedPublic

Description

Author: cnit

Description:
I am trying to make sure that my (yet unreleased) extension will work with future versions of MediaWiki. My extension needs a hook 'BeforePageDisplay' to process and generate some data. With js2-work r62694 and Extension:UsabilityInitiative r62695 and having in LocalSettings.php:

Vector enhancements (CollapsibleTabs, SimpleSearch, EditWarning)

require_once( "$IP/extensions/UsabilityInitiative/Vector/Vector.php" );

'BeforePageDisplay' is not called. When I comment out the second line:

#require_once( "$IP/extensions/UsabilityInitiative/Vector/Vector.php" );

'BeforePageDisplay' works again.


Version: unspecified
Severity: normal

Details

Reference
bz22584

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:02 PM
bzimport set Reference to bz22584.

Works for me with phase3 and UsabilityInitiative (both at r62695):

function blah() { die("blah"); }
require_once("$IP/../extensions/ParserFunctions/ParserFunctions.php");
require_once("$IP/../extensions/UsabilityInitiative/Vector/Vector.php");
require_once("$IP/../extensions/UsabilityInitiative/WikiEditor/WikiEditor.php");
require_once("$IP/../extensions/UsabilityInitiative/OptIn/OptIn.php");
require_once("$IP/../extensions/UsabilityInitiative/ClickTracking/ClickTracking.php");
$wgHooks['BeforePageDisplay'][] = 'blah';

Outputs "blah"

This could be a bug in js2-work, or simply a bug in your BeforePageDisplay hook function (sure you got the name right? Did you try adding die("blah") at the beginning?)

cnit wrote:

Roan, could you try with js2-work, please? Or, perhaps your area of development is unrelated to js2-work, then, perhaps someone else can try it?
My extension works at two different installations (win,linux) with 1.15.1, so that should not be a simple typo. Also, the extension works when I comment out the "Vector enhancement" line.

cnit wrote:

Here is the link to my unreleased extension:
http://mediawiki.narod.ru/EditConflict_0.4.1.tgz
there is no typo in hook call, indeed it works for long time.

cnit wrote:

There is no hook $wgHooks['EditPageMergeChanges'][] = 'EditConflict::doEditConflict'; currently defined in MediaWiki core, but that is unrelated, because that hook is only optional (via the simple patch of EditPage.php) and the extension works without patching of core. (The core patching is only an enhancement, not an requirement to run my extension).

cnit wrote:

Even, http://mediawiki.narod.ru/EditConflict_0.4.2.tgz
fixed some small bugs. Although, it was working with MediaWiki 1.15.1 and a clean js2-work r62695 without UsabilityInitiative + Vector enhancement, too (I've turned on most of another enhancements according to UsabilityInitiative installation instructions, but it was the Vector enhancement which prevented 'BeforePageDisplay' to be called).

Could you try with trunk instead of js2-work? If the very same thing works in trunk but is broken in js2-work, it's definitely not Vector's fault.

mdale wrote:

I have not merged updates from trunk into js2-work for sometime. Dmitriy why are you using js2-work branch? ( that branch is under development with only really only the /js part being maintained )

You should use trunk and wait until the updated javascript api stuff makes its way into trunk before worrying about future proofing your extension.

cnit wrote:

Allright, I'll try the trunk. I've thought that more visual enhancements will be available with js2-work (such as AJAX uploads and so on). I haven't studied last year changes in detail, but certainly that is a bigger than usual step between the core versions (when moving from 1.15.1).
Michael, if you are going to merge changes someday, you may close this bug. I wonder if some kind of automatical test (phpunit?) especially for hooks can be made. Perhaps, a test extension which would make sure that no hook calls are missed.

Is this still relevant, or "Oh so fixed"?