Last modified: 2008-10-10 20:34:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T9985, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 7985 - #ifexist parser function returns false for image pages from shared repository (Commons)
#ifexist parser function returns false for image pages from shared repository...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal normal with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
http://commons.wikimedia.org/wiki/Use...
: need-parsertest, patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-19 20:08 UTC by Yug
Modified: 2008-10-10 20:34 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch implementing #ifimageexist (1.51 KB, patch)
2006-11-21 22:27 UTC, Carl Fürstenberg
Details
Patch for ifexist (751 bytes, patch)
2006-11-23 18:19 UTC, Carl Fürstenberg
Details
implementation (768 bytes, patch)
2006-11-28 19:33 UTC, Carl Fürstenberg
Details

Description Yug 2006-11-19 20:08:24 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.
Comment 1 Carl Fürstenberg 2006-11-19 20:13:44 UTC
this is not a bug, the ParserFunctions are defined as {{#function:...}}
Comment 2 Yug 2006-11-19 20:17:04 UTC
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 ?
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2006-11-19 20:18:35 UTC
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.
Comment 4 Rob Church 2006-11-19 20:21:50 UTC
(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.
Comment 5 Yug 2006-11-19 20:22:41 UTC
to Simetrical :
...
Exactly.
Comment 6 Yug 2006-11-19 20:27:54 UTC
> 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.
Comment 7 Brion Vibber 2006-11-19 20:30:08 UTC
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. ;)
Comment 8 Rob Church 2006-11-19 21:02:28 UTC
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.
Comment 9 Yug 2006-11-21 21:21:16 UTC
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 ?
Comment 10 Phil Boswell 2006-11-21 21:56:05 UTC
(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.
Comment 11 Carl Fürstenberg 2006-11-21 22:27:30 UTC
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.
Comment 12 Rob Church 2006-11-21 22:40:24 UTC
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.
Comment 13 Yug 2006-11-21 22:55:41 UTC
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.
Comment 14 Yug 2006-11-21 22:57:25 UTC
[...]if {{ifexist:}} check the uploaded FILE, how [...]
Comment 15 Rob Church 2006-11-21 23:04:34 UTC
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.
Comment 16 Yug 2006-11-21 23:09:08 UTC
This seem to be a great deal. Then we have to show this information-distintion
clearly in one wiki-page.
Comment 17 Carl Fürstenberg 2006-11-23 18:19:56 UTC
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.
Comment 18 Rob Church 2006-11-23 21:06:40 UTC
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.
Comment 19 Yug 2006-11-25 11:37:43 UTC
So What should I use : {{ifexist:Media:Brion_shows_off_his_code.jpg}} ?
Comment 20 Rob Church 2006-11-25 18:30:29 UTC
Yes. And tell that filthy Vibber bloke to put it away. ;)
Comment 21 Yug 2006-11-25 20:05:10 UTC
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.
Comment 22 Rob Church 2006-11-25 20:50:52 UTC
It hasn't been applied to the software yet, let alone taken live.
Comment 23 Yug 2006-11-25 20:54:38 UTC
O.o Ok, thanks for this quick answer. :]
Comment 24 Phil Boswell 2006-11-25 23:44:32 UTC
(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?

Comment 25 Carl Fürstenberg 2006-11-28 19:33:23 UTC
Created attachment 2792 [details]
implementation

fixed whitespaces per Rob and fixed minor grammar in the comment.
Comment 26 Yug 2006-12-02 13:31:49 UTC
Please, when that work fine, show me the good syntaxe in this page :
 http://fr.wiktionary.org/wiki/Utilisateur:Yug/Test
many thanks
Comment 27 Yug 2007-01-23 16:41:39 UTC
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.
Comment 28 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-01-23 18:48:09 UTC
This feature has not yet been implemented.  If it were implemented, it would be RESOLVED FIXED.
Comment 29 Carl Fürstenberg 2007-01-23 19:03:14 UTC
(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. 
Comment 30 Jamie Hari 2007-05-26 16:26:45 UTC
Could someone review Carl's latest attachment? We might be able to add it to the extension...
Comment 31 Yug 2007-11-13 14:05:28 UTC
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
Comment 32 Roan Kattouw 2007-11-13 15:35:04 UTC
Fixed in r27460.
Comment 33 Yug 2007-11-13 15:42:23 UTC
Many Thanks !! When Will we be able to use it ?
Comment 34 Roan Kattouw 2007-11-13 15:45:18 UTC
(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.
Comment 35 Matt 2007-11-14 04:19:59 UTC
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 :)
Comment 36 Roan Kattouw 2007-11-14 13:49:18 UTC
(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.
Comment 37 Yug 2008-10-10 19:45:16 UTC
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,
Comment 38 Platonides 2008-10-10 20:02:51 UTC
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>
Comment 39 Yug 2008-10-10 20:34:31 UTC
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 !

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links