{{#ifexist}} doesn't work correctly for File namespace
Closed, InvalidPublic


The parser function {{#ifexist}} works as expected (i.e. checks for an existence of a file, even if it's on commons) if used with Media: prefix, but not with Image: or File:.

I think it is because of the following code in ParserFunctions_body.php:
if( $title->getNamespace() == NS_MEDIA ) {
/* If namespace is specified as NS_MEDIA, then we want to

  • check the physical file, not the "description" page.


It should test here also for the File: and Image: prefixes.

Version: unspecified
Severity: normal


bzimport set Reference to bz23412.
bzimport added a subscriber: Unknown Object (MLST).
Svick created this task.May 5 2010, 5:39 PM

I'd say this is a feature rather than a bug: you can test for the existence of the file description page with {{#ifexist:File:Foo.png}} and for the existence of the actual file with {{#ifexist:Media:Foo.png}}

happy.melon.wiki wrote:

(In reply to comment #1)

I'd say this is a feature rather than a bug

Indeed. It's even (deep breath) *documented* as such: [[mw:Help:Extension:ParserFunctions##ifexist]].

Add Comment