Last modified: 2014-04-22 07:49:24 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 T57970, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55970 - ForeignAPIRepo::findBySha1 should return all matching media, regardless of backend
ForeignAPIRepo::findBySha1 should return all matching media, regardless of ba...
Status: NEW
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.22.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-21 16:38 UTC by Brad Jorsch
Modified: 2014-04-22 07:49 UTC (History)
6 users (show)

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


Attachments

Description Brad Jorsch 2013-10-21 16:38:41 UTC
Most of the ForeignAPIRepo methods search recursively. For example, if you have a ForeignAPIRepo pointing to enwiki, asking it for File:Example.svg will return the Commons image by that name.

But this doesn't apply to ForeignAPIRepo::findBySha1. Querying eb2a8759ddf38da50f60feb11f7208f5ec11daac (currently the sha of [[commons:File:Example.svg]]) against that enwiki ForeignAPIRepo returns nothing.

I can think of 4 possible solutions. In decreasing order of complexity:

1. Add a "recursive" option to list=allimages (or a "localonly", if we want to make recursive operation the default). This would need all FileRepo subclasses to support some interface for all the other modes of list=allimages, such as "give me $limit files starting from $name" and "give me $limit file starting from $timestamp" (both ascending or descending).

2. Add a "list=allfilesbysha1" API module, that would basically call findBySha1s and return the results. Note it would need extra checks so that querying enwiki for d01b79a6781c72ac9bfff93e5e2cfbeef4efc840 wouldn't return Commons' File:Example.jpg (which is shadowed by enwiki's File:Example.jpg).

3. Make ForeginAPIRepo be local only. So if someone wants enwiki and commons as foreign repos, they need to configure two ForeginAPIRepos instead of just the one for enwiki. This is currently about a 4-line change, just adding 'localonly' to the prop=imageinfo queries.

4. Pretend it's not really a problem. ;)

Personally, I like #3. If we don't go with that here then I'll probably submit a patch to make "localOnly" an option for ForeignAPIRepo.
Comment 1 Bawolff (Brian Wolff) 2013-10-21 16:44:07 UTC
I've heard of quite a few people relying on foreign api being recursive.


One also has to be careful of people who include both enwiki and say dewiki as foreign repos. the recursiveness would make it list commons file twice. (Already somewhat of a problem)
Comment 2 Brion Vibber 2013-10-21 18:03:12 UTC
I find the proposed label 'recursive' confusing; I'd expect the behavior of "return all matching media, regardless of which backend they happen to be on" behavior by default from something called list=allimages to begin with...

Is that a bug with list=allimages?

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


Navigation
Links