Hi List,
I develop extensions for MediaWiki at work. We are using IIS, PHP 5, current MySQL, and MediaWiki version 1.8 (I believe). I have an extension that is supposed to replace <accNumTag>SomeInfo</AccNumTag> with a wiki table. It does this correctly, however, it seems to be running through the extension on pages that do not contain the invoking tag (accNumTag). This is severely slowing down the load of the edit page.
I've added some print statements to figure out what is going on and it seems that $input is getting a value even on pages that do not contain <accNumTag>. I think if I understood how extensions are called better I might be able to puzzle this out? Does anyone have any suggestions or pointers to a good "how the parser hook works" page?
As far as I can see the code looks normal?
function wfAccChecker() { global $wgParser; $wgParser->setHook( "AccNumTag", "accChecker" ); }
function accChecker ($input, $argv) { if (isset($input)&& !empty($input)) { . . . . } }
Thank you! Courtney Christensen
The snippet of code you posted appears (to me) to be correct, but here are some things to check:
* Make sure nothing makes reference to accChecker() other than your extension setup function. That is, make sure no other hooks are calling it. Also make sure it's not being accidentally called elsewhere in the file or in LocalSettings.
* Editorially, maybe the tag is being used in a template which is being included in other pages? Or, maybe the tag is being used in an article in the MediaWiki namespace - causing it to be re-rendered on each page view.
-- Jim R. Wilson (jimbojw)
On 8/30/07, Christensen, Courtney ChristensenC@battelle.org wrote:
Hi List,
I develop extensions for MediaWiki at work. We are using IIS, PHP 5, current MySQL, and MediaWiki version 1.8 (I believe). I have an extension that is supposed to replace <accNumTag>SomeInfo</AccNumTag> with a wiki table. It does this correctly, however, it seems to be running through the extension on pages that do not contain the invoking tag (accNumTag). This is severely slowing down the load of the edit page.
I've added some print statements to figure out what is going on and it seems that $input is getting a value even on pages that do not contain <accNumTag>. I think if I understood how extensions are called better I might be able to puzzle this out? Does anyone have any suggestions or pointers to a good "how the parser hook works" page?
As far as I can see the code looks normal?
function wfAccChecker() { global $wgParser; $wgParser->setHook( "AccNumTag", "accChecker" ); }
function accChecker ($input, $argv) { if (isset($input)&& !empty($input)) { . . . . } }
Thank you! Courtney Christensen
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
- Make sure nothing makes reference to accChecker() other than your
extension setup function. That is, make sure no other hooks are
calling >it. Also make sure it's not being accidentally called elsewhere in the >file or in LocalSettings.
- Editorially, maybe the tag is being used in a template which is being
included in other pages? Or, maybe the tag is being used in an article
in >the MediaWiki namespace - causing it to be re-rendered on each page view.
-- Jim R. Wilson (jimbojw)
On 8/30/07, Christensen, Courtney ChristensenC@battelle.org wrote:
I develop extensions for MediaWiki at work. We are using IIS, PHP 5,
current MySQL, and MediaWiki version 1.8 (I believe). I have an extension that is supposed to replace <accNumTag>SomeInfo</AccNumTag>
with a wiki table. It does this correctly, however, it seems to be running through the extension on pages that do not contain the invoking tag (accNumTag). This is severely slowing down the load of the edit page.
I've added some print statements to figure out what is going on and
it
seems that $input is getting a value even on pages that do not
contain
<accNumTag>. I think if I understood how extensions are called
better
I might be able to puzzle this out? Does anyone have any suggestions
or pointers to a good "how the parser hook works" page?
As far as I can see the code looks normal?
function wfAccChecker() { global $wgParser; $wgParser->setHook( "AccNumTag", "accChecker" ); }
function accChecker ($input, $argv) { if (isset($input)&& !empty($input)) { . . . . } }
Thanks for the suggestions Jim. I've checked that nothing else calls accChecker and we don't use templates. I've cleared my local cache, restarted IIS, and used action=purge on one of the pages I'm testing with. Unfortunately to no avail. It seems almost like the last value that it ran correctly with is getting stuck in ...somewhere, and that is probably my biggest problem. I can't figure out where a value would be stuck in input. PHP is stateless unless explicitly specified otherwise, right? Has anyone else had a problem where data they were trying to process in an extension got stuck in the extension's input so that it was there the next time they tried to run the extension as well?
Unfortunately I can't give you access to the wiki, since it is only a local copy, but I could probably post the whole code of the extension.
Any help is GREATLY appreciated, thanks! -Courtney
wikitech-l@lists.wikimedia.org