https://bugzilla.wikimedia.org/show_bug.cgi?id=55970

       Web browser: ---
            Bug ID: 55970
           Summary: ForeignAPIRepo::findBySha1 is not recursive
           Product: MediaWiki
           Version: 1.22-git
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: File management
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]
    Classification: Unclassified
   Mobile Platform: ---

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to