Last modified: 2008-08-28 09:21:41 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T9051, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 7051 - ParserFunctions only work in global parser
ParserFunctions only work in global parser
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://about.extension.org/wiki/
: patch, patch-need-review
Depends on:
Blocks: 10062
  Show dependency treegraph
 
Reported: 2006-08-18 03:06 UTC by James Robinson
Modified: 2008-08-28 09:21 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
patch to allow ParserFunctions to work with other parser objects (2.13 KB, patch)
2006-08-18 03:07 UTC, James Robinson
Details

Description James Robinson 2006-08-18 03:06:52 UTC
I added a comment here: http://meta.wikimedia.org/wiki/Talk:ParserFunctions

but thought a patch that folks could review would be helpful.

In summary, the new MagicWords added by the extension are only available to the
global parser: $GLOBALS['wgParser']

In several extensions i use my own local parser so as to not muck up the global
variables which can have nasty side effects; however, parsing an article with a
local parser basically fails since the ParserFunctions MagicWords are not available.
Comment 1 James Robinson 2006-08-18 03:07:38 UTC
Created attachment 2244 [details]
patch to allow ParserFunctions to work with other parser objects
Comment 2 Tim Starling 2006-08-18 03:10:43 UTC
You can clone $wgParser to produce an independent local parser with all the extensions 
registered, this has the advantage of avoiding setup overhead. 
Comment 3 James Robinson 2006-08-18 03:16:58 UTC
That did not occur to me.  I'll test that out.  Thank you kindly.
Comment 4 Tim Starling 2006-08-18 03:36:37 UTC
Your suggestion is still a good one, and we may well implement something similar to it. My 
only reservation is that extension registration is best done in firstCallInit() rather than 
clearState(). That would require adding a new hook. Hook-based registration is better than 
what we have now, but ideally I would like to have the registered extension list cached as 
a whole, rather than initialised by running code from every extension on every web request.
Comment 5 Rob Church 2007-08-31 10:11:20 UTC
Reopening; no indication of how this was fixed, and I see no relevant commits.
Comment 6 Roan Kattouw 2008-08-28 09:21:41 UTC
(In reply to comment #5)
> Reopening; no indication of how this was fixed, and I see no relevant commits.
> 

Comment #2 'fixes' this.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links