tl;dr: Is it possible to enforce an order on callback functions that are attached to the same hook?
Detailed question:
I've written a custom extension that modifies Category pages. It creates a subclass of CategoryPage and inserts it using the hook "ArticleFromTitle." It works great on its own, but unfortunately, another popular extension we use, CategoryTree, does exactly the same thing, and it overrides my extension's modifications.
I can write my extension to check for the presence of CategoryTree and compensate for it. Unfortunately, MediaWiki 1.28.0 always runs CategoryTree's callback after mine, so no matter what I do, CategoryTree wins. (Strangely, in 1.27, my extension always won.)
Is there a way to ensure that my extensions ArticleFromTitle callback runs *after* CategoryTree's callback?
Thank you very much. DanB
Aloha,
On 12/30/2016 11:29 AM, Daniel Barrett wrote:
Is there a way to ensure that my extensions ArticleFromTitle callback runs *after* CategoryTree's callback?
Officially? Not really. What most people do is register a extension function[1] that in turn registers the hook by modifying $wgHooks. Because extension functions run way after extension registration runs, your hook will be registered later, and hence run later.
[1] https://www.mediawiki.org/wiki/Manual:$wgExtensionFunctions
-- Legoktm
On 12/30/2016 11:29 AM, Daniel Barrett wrote:
Is there a way to ensure that my extensions ArticleFromTitle callback runs *after* CategoryTree's callback?
Legoktm responded:
Officially? Not really. What most people do is register a extension function that in turn registers the hook by modifying $wgHooks. Because extension functions run way after extension registration runs, your hook will be registered later, and hence run later.
Thank you! Your technique worked beautifully.
DanB
mediawiki-l@lists.wikimedia.org