Hey Minute,
I believe it has to do with the fact that your function hooking into ParserGetVariableValueSwitch returns boolean false when the magic word doesn't match. This has the effect of killing the wgRunHooks() stack before any other extension gets run.
Also, you may want to consider pushing the calculated value back into the cache so that it doesn't have to be recalculated each time the Parser encounters the magic word. So, continuing your aforementioned example, you'd have something like this:
$wgHooks[ "ParserGetVariableValueSwitch" ][] = "wfTotalRevisionsAssign"; function wfTotalRevisionsAssign( &$parser, &$cache, &$magicWordId, &$ret ) { if( MAG_TOTALREVISIONS !== $magicWordId ) return true; global $wgTitle; $dbr =& wfGetDB( DB_SLAVE ); $ret = $dbr->estimateRowCount( "revision", "*", array( "rev_page" => $wgTitle->getArticleID() ) ); $cache[ MAG_TOTALREVISIONS ] = $ret; return true; }
Note: I have not tested the above - just off the top of my head.
Good luck, hope this helps!
-- Jim R. Wilson (jimbojw)
On Dec 29, 2007 4:33 PM, Minute Electron minuteelectron@googlemail.com wrote:
Hello,
For a project I've been working on we have been developing a variety of new extensions, in particular several new magic words. Unfourtuantley we have been having problems with getting them to work with one another.
When the extensions are used on their own (i.e. the require_once for all but one commented out) it works fine, but, when more than one is installed simultaneously, none work.
I've tried various ways but I cannot see any error. The source code for one of my extensions can be found here http://www.mediawiki.org/wiki/Extension:TotalRevisions#Source_Code - the others have not yet been published, although they all identical system (just a difference in what they output). Can anyone see why these don't work when installed together.
Thank you in advanced.
-- MinuteElectron. http://my.brlcad.org/~MinuteElectron/
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l