Thanks Brion. Is there a conditional that my extension can check to determine 
if this is a user-facing page render in the UI, vs. one of these internal page 
renders? (specifically the internal page rendering on Save.)

Thank you,
DanB

-----Original Message-----
From: mediawiki-l-boun...@lists.wikimedia.org 
[mailto:mediawiki-l-boun...@lists.wikimedia.org] On Behalf Of Brion Vibber
Sent: Friday, December 06, 2013 1:35 PM
To: MediaWiki announcements and site admin list
Subject: Re: [MediaWiki-l] Preventing a tag extension from rendering twice on 
save?

Your tag hook function will be run once every time the page is *parsed & 
rendered*, not every time the page is saved. It's common to see multiple parses 
on save; for instance it may be parsed once for link table updates & initial 
caching with generic settings, then parsed & rendered again for your settings 
as you load the page up.

You'll also likely see it run during times such as:
* background update of the page due to update of a template
* view of an old revision from history

So if your extension assumes that just having a parser tag extension function 
getting run means you're in a page save operation, you'll need to update that 
assumption and work with the actual page save hooks.

-- brion


On Thu, Dec 5, 2013 at 11:32 AM, Daniel Barrett <d...@vistaprint.com> wrote:

> I've noticed that parser tag extensions render twice when an article 
> is saved from the edit page.
> All I did was write a parser tag <foo> that runs error_log('foo').
> It prints once when I hit <foo/> on a page, but twice when saving the 
> page from the wiki editor.
>
> Is there a way to prevent this double-running on save?
> Even way for the extension itself to detect it's on the first (or 
> second) run and suppress itself?
>
> I have an extension that is heavyweight, making a SQL query to an 
> external database, and I don't want to run twice.
>
> Thanks for any insights!
> DanB
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to