On 11/29/07, werdna(a)svn.wikimedia.org
<werdna(a)svn.wikimedia.org> wrote:
Revision: 27946
Author: werdna
Date: 2007-11-29 10:42:48 +0000 (Thu, 29 Nov 2007)
Log Message:
-----------
Prevent the parser function #ifexist being used more than a certain amount on error
pages. The maximum number of #ifexist queries can be set in $wgMaxIfExistCount, which is,
by default, 100. Any more uses over here will default to the "else" text. Done
to discourage templates like Template:highrfc-loop on enwiki, which willingly does
something like 50 database queries for a template that is used for many users on one page.
Clearly suboptimal from a performance perspective.
Is there any way, instead, to defer these so they can be done all at
once? Tim, do you have any thoughts on whether this is reasonable?
(I would suspect not, but it doesn't hurt to ask.)
Wow, wow, wow,
ParserFunctions has a DB query in a function that can
potentially be called hundreds of times? Domas would go nuts if he knew
that... Ifexist should do the following:
- Add all requested titles to a LinkBatch [1]
- Return a marker like marker-ifexist-0 and store the ifTrue and ifFalse
values in an array
- In a ParserAfterTidy hook, run LinkBatch::execute() (checks for
existence) and str_replace() all markers
Roan Kattouw (Catrope)