Release status: stable
|Description||This extension enables performing a 'second pass' through a 'parser cached' page replacing for 'dynamic' variables.|
|MediaWiki||1.10, 1.11, 1.12|
|License||No license specified|
See SVN ($Id$)
|Check usage and version matrix|
This extension enables performing a 'second pass' through a 'parser cached' page replacing for 'dynamic' variables. In a word, once a page is normally processed (i.e. 'first pass') Mediawiki 'fixes' all templates & variables in a 'parser cached' page. This extension enables substituting selected variables upon page view whilst still preserving the valuable job performed by the parser/parser cache.
Additionally, the extension enables the execution of 'parser functions' and 'magic words' *after* the page's 'tidy' process is executed. This functionality is referred to as 'parser after tidy'. This capability allows for the inclusion of text that would otherwise upset MediaWiki's parser e.g. execution of a parser functions that replaces text in an 'html' tagged section.
Finally, the extension enables the execution of 'parser functions' and 'magic words' *before* the page's 'strip' process is executed i.e. before the MediaWiki begins parsing the page. This functionality is referred to as 'parser before strip'.
Theory of operation 
In the standard MW processing flow, when a page is viewed it is retrieved (either from the cache or 'raw' from the database) and sent to the 'output page' object. What this extension does is intercept the flow process through the 'OutputPageBeforeHTML' hook and:
- Extracts the
(($ magic word| ... $))tags (and other supported invocation formats)
- Looks for 'magic word' in the dictionary and retrieve the value if found
- Looks for 'magic word' in the 'parser function' dictionary and execute the function if found
This same process is performed for both 'parser phase 2' and 'parser after tidy' functionalities. See Extension:ParserPhase2/Flow Summary for more details.
- Enable/disable keywords for 'sectional execution' support
- By default, replacement is 'enabled' until a 'disable' magic word is encountered
- Execution is stopped (i.e. no replacement occurs) until an 'enable' magic word is next encountered
- Integrates with the standard Mediawiki Parser Cache
- Provides a simple 'magic word' based interface to standard Mediawiki variables & parser functions
- Handles two invocation forms for the 'parser phase 2' functionality:
- (( ... ))
- Handles one invocation for the 'parser after tidy' functionality:
- ((% ... %))
- Handles one invocation for the 'parser before strip' functionality:
- ((@ ... @))
- Master Off functionality
- ((% parserphase2off %)) for turning off all 'parser after tidy' processing on the page
- ((@ parserphase2off @)) for turning off all 'parser before strip' processing on the page
- (($ parserphase2off $)) for turning off all 'output before HTML' processing on the page
- Remove the space between the keyword 'parserphase2off' and the enclosing delimiters for proper usage.
ParserPhase2 functionality 
(($magic word|...parameters...$)) or (( ))
- Where 'variable' is a standard Mediawiki magic word e.g. CURRENTTIME, REVISIONID etc.
Parser After Tidy functionality 
Parser Before Strip functionality 
Recursive invocation is supported; example:
(($#f1 | (($#f2$)) | (($#f3$)) $))
Issues with Wikitext tables 
There are some limitations in the usage of this extension with wikitext based tables since parameters are separated through the pipe | character. I think the place would be 3, 1 and 2 are respective to the categorized optional parents, and thus parameter is void!
See the Mediawiki Extension table entry "download" above.
Extension:ExtensionManager: See footnote
- Add the following to LocalSettings.php, if the extension was downloaded from Jean-Lou Dupont's MediaWiki SVN directory (link in the download entry of the table above):
require_once( "$IP/extensions/ParserPhase2/ParserPhase2.php" );
- Since this Extensions is depending on StubManager, add the line after the StubManager include, or else your Wiki won't work.
Upgrades through PEAR 
Sometimes, it is necessary to clear PEAR's cache in order to perform upgrades.
or use the force method:
PEAR Web Frontend 
RSS feed 
To keep up-to-date with this channel, use the following RSS feed__.
Consult User Jldupont's page.
- The most recent release is always available through the extension's PEAR and SVN repositories. This page is not necessarily up-to-date.
- Extension:ExtensionManager does not require any modification to LocalSettings.php because ExtensionManager includes the extension.
Note that if PHP code caching is in place (e.g. APC, eAccelerator), then to successfully complete the installation a cache flush might be needed.
- Modifications to
LocalSettings.phpis only necessary if not using Extension:ExtensionManager
- fixed client side caching logic due to a bug in PHP's preg_match_all function
- fixed issue with $wgParser not having a valid 'mTitle' property set
- added 'disable' command
- Removed dependency on 'ExtensionClass'
- Added 'stub' capability
- Added 'EndParserPhase2' hook
- Added pattern: ((magic word|... )) which more closely maps to standard MW parser function calling
- DO NOT MIX PATTERNS ON THE SAME PAGE i.e. no (($...$)) mixing up with ((...))
- Added functionality to execute parser functions/magic words just after the 'tidy' process
- Added functionality to execute parser functions/magic words just BEFORE the 'strip' process i.e. before the parser really begins.
- Added 'enable' magic word
- Added support for 'sectional execution' i.e. replacement between 'enable' and 'disable' magic words
- Added 'recursive' (aka 'nesting') processing functionality
- Changed calls to $this->execute in order to remove PHP warning.
- Moved to PEAR repository
- Removed unused variable in order to avoid unecessary PHP notice
- Added 'master off' functionality
|1.1.1||Fixed for MediaWiki 1.12 compatiblity|
- possibly fix to allow mixing up (($..$)) and ((..)) patterns on the same page (TBD)