[MediaWiki-l] ParserFunctions executes twice

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[MediaWiki-l] ParserFunctions executes twice

Pablo Nuñez
Hi, we are trying to invoke a ParserFunction we define in our wiki. That
function invoke another that makes changes in some pages of the wiki. The
problem is that every ParserFunction executes twice.
That's a little strange, because sometimes it executes twice and others
once. It occurs  with every ParserFunction.
Is it something normal or we could configure to execute once?

Thanks.
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: ParserFunctions executes twice

Brion Vibber
On Tue, Nov 20, 2012 at 3:27 PM, Pablo Nuñez <[hidden email]> wrote:

> Hi, we are trying to invoke a ParserFunction we define in our wiki. That
> function invoke another that makes changes in some pages of the wiki. The
> problem is that every ParserFunction executes twice.
> That's a little strange, because sometimes it executes twice and others
> once. It occurs  with every ParserFunction.
> Is it something normal or we could configure to execute once?
>

Sounds like the page is being parsed twice -- which is not atypical on
edit. You might get one parse for the default global settings, parser
cache, and link tables, and then another parse for the current user if
their settings differ.

In general, you should assume that parsing is idempotent -- the same
actions should happen and the same result should be returned every time you
call with the same input. Otherwise you may run into trouble with things
not expected what you're doing.

-- brion
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l