#ifexist parser function returns false for image pages from shared repository (Commons)
Closed, ResolvedPublic

Description

Author: hugo.lpz

Description:
Not expected result with a fonction {{ifexist: ... | then ... | or... }}.
The function work perfectly on commons, see
http://commons.wikimedia.org/wiki/User:Yug/Test , but doesn't work to call the
same images on others projects.

After an enquery, it appear :

  1. that's not a chinese character problem.
  2. that's only with Namespace "Image:"... issue.
  3. {{ifexist: work only for page "edited" on the mediawikiproject. In exemple,

the Image:Wikipedia.png is not on wikitionary-fr , but the page was edited, so
the function {{ifexist: will work. If I delete the 2 edit, the pic is still
visible on wikitionary-fr, but the page does not "exist", and the function
{{ifexist: will not work.


Version: unspecified
Severity: normal
URL: http://commons.wikimedia.org/wiki/User:Yug/Test

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz7985.
bzimport created this task.Via LegacyNov 19 2006, 8:08 PM
AzaToth added a comment.Via ConduitNov 19 2006, 8:13 PM

this is not a bug, the ParserFunctions are defined as {{#function:...}}

bzimport added a comment.Via ConduitNov 19 2006, 8:17 PM

hugo.lpz wrote:

I'm nowadays working on {{ifexist: function such as "if Image:Blabla.png exist,
then show "that", otherwise show "This image does not exist". For such purpose,
(I) need that mediawiki look if the IMAGE exist and not its "host page".

Use :

  • Build "if"-function-template about <b>Images</b> on the subprojects of wikimedia.
  • Then rename series of images without destroying subprojects' pages

Have we a solution ? Can we get an improvement ?

bzimport added a comment.Via ConduitNov 19 2006, 8:18 PM

ayg wrote:

Read the links. The function was used correctly, so that at least doesn't make
it invalid. I'm busy today, but I'd guess the problem Yug is having is that
{{#ifexist:}} doesn't work for checking uploaded files, only for checking pages,
and it doesn't work for shared repositories like Commons.

bzimport added a comment.Via ConduitNov 19 2006, 8:21 PM

robchur wrote:

(In reply to comment #3)

{{#ifexist:}} doesn't work for checking uploaded files, only for checking pages,
and it doesn't work for shared repositories like Commons.

That is indeed the case; the function was provided as a page existence check.

bzimport added a comment.Via ConduitNov 19 2006, 8:22 PM

hugo.lpz wrote:

to Simetrical :
...
Exactly.

bzimport added a comment.Via ConduitNov 19 2006, 8:27 PM

hugo.lpz wrote:

That is indeed the case; the function was provided as a page existence check.

So the need is not to fix this function, but to find which other function allow
to check uploaded files shared on commons.

brion added a comment.Via ConduitNov 19 2006, 8:30 PM

Changed summary to describe the issue better.

In general we have page existence checks for the Image namespace overridden to act as existing for pages where an
image exists, whether local or on the shared repository. This makes things feel cleaner, as for all intents and
purposes they "exist" to someone poking at them.

I'm not sure whether it would be better to have #ifexist behave this way as well, or if a function specifically to
check for image existence might be better. I do hate feature creep, though. ;)

bzimport added a comment.Via ConduitNov 19 2006, 9:02 PM

robchur wrote:

It would probably make sense to have #ifexist behave in that manner; it isn't
going to break existing uses, it reduces the amount of colon functions people
have to remember, and it's just plain sane to do it. If people use, e.g.
{{#ifexist:Image:Brion_shows_off_his_code.jpg}}, they're probably expecting it
to reflect the image's existence.

bzimport added a comment.Via ConduitNov 21 2006, 9:21 PM

hugo.lpz wrote:

I think it's need to have two function for and Image wiki page :

  1. one for the page (edited/not edited), currently : {{#ifexist:
  2. one to check uploaded files, currently : no function avalable.

After thinking about this issue, I think "a new function such
{{#ifexistfile:Image:Brion_shows_off_his_code.jpg}} to check uploaded files"
should be the best.
But have we a page to know about all functions avalable somewhere ?

Phil_Boswell added a comment.Via ConduitNov 21 2006, 9:56 PM

(In reply to comment #8)

It would probably make sense to have #ifexist behave in that manner; it isn't going to break existing uses, it
reduces the amount of colon functions people have to remember, and it's just plain sane to do it. If people use, e.g.
{{#ifexist:Image:Brion_shows_off_his_code.jpg}}, they're probably expecting it to reflect the image's existence.

On the other hand, the intuitive meaning of {{#ifexist}} equates to "is not a red-link". For images from commons,
should this meaning be correct? In other words, should there be a simple way to detect whether an image is available
but not local?

The suggested {{#ifexistfile}} {in comment #9) would seem to satisfy that possible requirement.

AzaToth added a comment.Via ConduitNov 21 2006, 10:27 PM

Patch implementing #ifimageexist

Have made an simple implementation of {{#ifimageexist:}}, I check not only if
the image exit, but also if the image is renerable. Sadly I don't know if this
is enough to check if a file is available on commons etc... or if that requires
more checking.

attachment ifimgexist.patch ignored as obsolete

bzimport added a comment.Via ConduitNov 21 2006, 10:40 PM

robchur wrote:

I still think it makes more sense to alter the functionality of {{#ifexist}} to
deal with this situation; it means less colon functions to remember, and it
makes sense to fix the behaviour of the existing one rather than work around it
with a new one.

bzimport added a comment.Via ConduitNov 21 2006, 10:55 PM

hugo.lpz wrote:

I suggested to have two differents function because of one situation :

Image:page edited + no image avalable.

if {{ifexist:}} check the uploaded page, how find such page ?

Except the need for such exeptional (minor) cases, I also think that just one
function make more sense.

bzimport added a comment.Via ConduitNov 21 2006, 10:57 PM

hugo.lpz wrote:

[...]if {{ifexist:}} check the uploaded FILE, how [...]

bzimport added a comment.Via ConduitNov 21 2006, 11:04 PM

robchur wrote:

Another option would be to allow the user to pass in Image as the namespace to
check the page's existence, and Media as the namespace when checking the actual
file's existence.

bzimport added a comment.Via ConduitNov 21 2006, 11:09 PM

hugo.lpz wrote:

This seem to be a great deal. Then we have to show this information-distintion
clearly in one wiki-page.

AzaToth added a comment.Via ConduitNov 23 2006, 6:19 PM

Patch for ifexist

This patch will add a check if the namespace is NS_MEDIA, then we'll check the
file instead of it's page.

attachment ifexist.patch ignored as obsolete

bzimport added a comment.Via ConduitNov 23 2006, 9:06 PM

robchur wrote:

Please observe existing code conventions. Some additional whitespace as used
elsewhere in the file makes things easier to read. That comment also doesn't
need to be so verbose; if anything, a one-liner will do.

bzimport added a comment.Via ConduitNov 25 2006, 11:37 AM

hugo.lpz wrote:

So What should I use : {{ifexist:Media:Brion_shows_off_his_code.jpg}} ?

bzimport added a comment.Via ConduitNov 25 2006, 6:30 PM

robchur wrote:

Yes. And tell that filthy Vibber bloke to put it away. ;)

bzimport added a comment.Via ConduitNov 25 2006, 8:05 PM

hugo.lpz wrote:

Don't work for me in commons.
see :
http://commons.wikimedia.org/w/index.php?title=User%3AYug%2FTest&diff=3613915&oldid=3561268

I tryed for namespace : NS_MEDIA ; Media ; MEDIA ; Ns_media ; Ns_Media ; NS_Media ;
No one worl fine on commons.

bzimport added a comment.Via ConduitNov 25 2006, 8:50 PM

robchur wrote:

It hasn't been applied to the software yet, let alone taken live.

bzimport added a comment.Via ConduitNov 25 2006, 8:54 PM

hugo.lpz wrote:

O.o Ok, thanks for this quick answer. :]

Phil_Boswell added a comment.Via ConduitNov 25 2006, 11:44 PM

(In reply to comment #10)

In other words, should there be a simple way to detect whether an image is available but not local?

Is this question answered with the new suggestion? In other words, would {{#ifexist:Media:example.jpg}} and
{{#ifexist:Image:example.jpg}} be TRUE and FALSE respectively if "example.jpg" were hosted at commons?

AzaToth added a comment.Via ConduitNov 28 2006, 7:33 PM

implementation

fixed whitespaces per Rob and fixed minor grammar in the comment.

Attached: ifexist.patch

bzimport added a comment.Via ConduitDec 2 2006, 1:31 PM

hugo.lpz wrote:

Please, when that work fine, show me the good syntaxe in this page :
http://fr.wiktionary.org/wiki/Utilisateur:Yug/Test
many thanks

bzimport added a comment.Via ConduitJan 23 2007, 4:41 PM

hugo.lpz wrote:

Hello, please what is the situation of the bug ?

Is it already applied to the software ? what is the syntaxe ?

Can you show it there : http://fr.wiktionary.org/wiki/Utilisateur:Yug/Test please.

bzimport added a comment.Via ConduitJan 23 2007, 6:48 PM

ayg wrote:

This feature has not yet been implemented. If it were implemented, it would be RESOLVED FIXED.

AzaToth added a comment.Via ConduitJan 23 2007, 7:03 PM

(In reply to comment #28)

This feature has not yet been implemented. If it were implemented, it would

be RESOLVED FIXED.

I have made an implementation, but it hasn't been reviewed or applied yet.

bzimport added a comment.Via ConduitMay 26 2007, 4:26 PM

webmaster wrote:

Could someone review Carl's latest attachment? We might be able to add it to the extension...

bzimport added a comment.Via ConduitNov 13 2007, 2:05 PM

hugo.lpz wrote:

REVIEW NEED ....(!)

Hello, someone may him finish this issue ?
I'm leaving Wikipedia for personnal reason, and they are some Wikidictionary users and Commons' user who are waiting a solution for this bug. Thanks to make your best,

[http://fr.wikipedia.org/wiki/Utilisateur:Michelet/Test : page showing that this issue is not applied ]

Regards,

Yug

Catrope added a comment.Via ConduitNov 13 2007, 3:35 PM

Fixed in r27460.

bzimport added a comment.Via ConduitNov 13 2007, 3:42 PM

hugo.lpz wrote:

Many Thanks !! When Will we be able to use it ?

Catrope added a comment.Via ConduitNov 13 2007, 3:45 PM

(In reply to comment #33)

Many Thanks !! When Will we be able to use it ?

Whenever Brion gets around to updating the software Wikipedia runs. On your own wiki (if you have one), you can use it right now by checking out the source from SVN.

bzimport added a comment.Via ConduitNov 14 2007, 4:19 AM

fearow00 wrote:

Wouldnt it make more sense to have ifexists on Image: return if there is a page there, and ifexists on Media if there is a file by that name available? It would make a bit more sense. Although the current way works fine :)

Catrope added a comment.Via ConduitNov 14 2007, 1:49 PM

(In reply to comment #35)

Wouldnt it make more sense to have ifexists on Image: return if there is a page
there, and ifexists on Media if there is a file by that name available? It
would make a bit more sense. Although the current way works fine :)

That's exactly the behavior I committed yesterday.

bzimport added a comment.Via ConduitOct 10 2008, 7:45 PM

hugo.lpz wrote:

hello,
the function still doesn't work for me. see http://commons.wikimedia.org/wiki/User:Micheletb/Test . can you give me a working example ? that will help me and the japanese wikibook a lot.

regards,

Platonides added a comment.Via ConduitOct 10 2008, 8:02 PM

Sure http://commons.wikimedia.org/w/index.php?title=User%3AMicheletb%2FTest&diff=15172615&oldid=8477402

NS_MEDIA just identifies the namespace number. You want to use Media:<filename>

bzimport added a comment.Via ConduitOct 10 2008, 8:34 PM

hugo.lpz wrote:

CLOSED ! many thanks ! that' s perfect now ! thanks to platonides !! I already sent message to some other interested users working on the japanese wikibook to use this function ;)

many thanks to every one !

Add Comment