Last modified: 2008-10-10 20:34:31 UTC
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 : # that's not a chinese character problem. # that's only with Namespace "Image:"... issue. # {{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.
this is not a bug, the ParserFunctions are defined as {{#function:...}}
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 ?
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.
(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.
to Simetrical : ... Exactly.
> 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.
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. ;)
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.
I think it's need to have two function for and Image wiki page : # one for the page (edited/not edited), currently : {{#ifexist: # 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 ?
(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.
Created attachment 2753 [details] 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.
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.
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.
[...]if {{ifexist:}} check the uploaded FILE, how [...]
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.
This seem to be a great deal. Then we have to show this information-distintion clearly in one wiki-page.
Created attachment 2767 [details] 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.
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.
So What should I use : {{ifexist:Media:Brion_shows_off_his_code.jpg}} ?
Yes. And tell that filthy Vibber bloke to put it away. ;)
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.
It hasn't been applied to the software yet, let alone taken live.
O.o Ok, thanks for this quick answer. :]
(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?
Created attachment 2792 [details] implementation fixed whitespaces per Rob and fixed minor grammar in the comment.
Please, when that work fine, show me the good syntaxe in this page : http://fr.wiktionary.org/wiki/Utilisateur:Yug/Test many thanks
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.
This feature has not yet been implemented. If it were implemented, it would be RESOLVED FIXED.
(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.
Could someone review Carl's latest attachment? We might be able to add it to the extension...
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
Fixed in r27460.
Many Thanks !! When Will we be able to use it ?
(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.
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 :)
(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.
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,
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>
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 !