Decide & Implement the behaviour for FileImporter & FileExporter when they come across files on another wiki
Closed, ResolvedPublic

Description

Example

On enwiki users can browse to the file https://en.wikipedia.org/wiki/File:21_Leaders_2012_Honoree_Deedee_Corradini.jpg.
This file is actually hosted on commons

Currently when trying to import this file the importer will die and the API does not return the expected information from the API

Questions

  1. Do we want the FileImporter to be able to import files in this way. We should think about the third party use case here slightly. For example, if a 3rd party is running a wiki running FileImporter do we want them to be able to use the URL https://en.wikipedia.org/wiki/File:21_Leaders_2012_Honoree_Deedee_Corradini.jpg to import the file from commons? If so, do we pretend the file is coming from enwiki or from commons? If not, what do we display to the user in these cases?
  2. Do we want the FileExporter to show the move/copy file link on these pages? I think the answer to this is probably no.

Once decisions have been made on the above issues we can close this ticket and create the relevant tasks for implementation.

Addshore created this task.Mar 22 2017, 5:04 PM

To 1: At least for v1 I would restrict usage to importing to Commons and nothing else. If you feel like we should support more, let me know and we will discuss it later
To 2: No, we only want to show the link if the file is really just on wp (see T144480 , another hidden condition ;) )

Change 344331 had a related patch set uploaded (by Addshore):
[mediawiki/extensions/FileExporter@master] Only show link for local files

https://gerrit.wikimedia.org/r/344331

Addshore renamed this task from Decide on the behaviour when FileImporter & FileExporter come across files on another wiki to Decide & Implement the behaviour for FileImporter & FileExporter when they come across files on another wiki.Mar 23 2017, 9:55 AM
Addshore claimed this task.
Addshore moved this task from Proposed to Sprint ready on the WMDE-QWERTY-Team-Board board.
Addshore moved this task from Backlog to In Progress on the User-Addshore board.

Change 344338 had a related patch set uploaded (by Addshore):
[mediawiki/extensions/FileImporter@master] Cleanly show warning when trying to import from shared repo

https://gerrit.wikimedia.org/r/344338

With the above patches the exporter will no longer show the link on such pages and the importer will display an error as below:

Cool stuff! @Jan_Dittrich do you have an idea for a good error message?

Error message: I would write them like we would explain it to a person in real life (though in a terse way):
"This function imports files to Wikimedia commons. The file you tried to import is already on Wikimedia commons: <link to file on commons>" ("Wikimedia commons" can be a configurable string)

Addshore moved this task from Needs Review to Next on the User-Addshore board.

I'll change the message to be something that accepts a parameter (the link to the file on the local wiki).
For specifying "Wikimedia commons" it may be a better idea to add this message version to the WikimediaMessages extension (which will thus override it)

Change 344331 merged by jenkins-bot:
[mediawiki/extensions/FileExporter@master] Only show link for local files

https://gerrit.wikimedia.org/r/344331

Change 344338 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Cleanly show warning when trying to import from shared repo

https://gerrit.wikimedia.org/r/344338

I'll change the message to be something that accepts a parameter (the link to the file on the local wiki).
For specifying "Wikimedia commons" it may be a better idea to add this message version to the WikimediaMessages extension (which will thus override it)

This probably will come along side a patch which localizes many of the error messages throughout the extension.

Error message: I would write them like we would explain it to a person in real life (though in a terse way):
"This function imports files to Wikimedia commons. The file you tried to import is already on Wikimedia commons: <link to file on commons>" ("Wikimedia commons" can be a configurable string)

So, after looking at this again without doing additional checks we can't actually 'be sure' that the image 'from another wiki' is from the current wiki the code is running on, we simply know that it is not on the source wiki.

Again for the WMF usecase the message "Can't import a file from a shared repository." can be changed on wiki to say something like "This function imports files to Wikimedia commons. The file you tried to import is already on Wikimedia commons"

Localization of this message was added in https://gerrit.wikimedia.org/r/#/c/348459/ and thus I'll move this to done / review.

Addshore moved this task from Next to Needs Review on the User-Addshore board.Apr 17 2017, 2:18 PM
Addshore moved this task from Sprint ready to Currently in sprint on the WMDE-QWERTY-Team-Board board.

Decision in PM meeting on 2017-05-02: We agree to stick with the current message and customize the message for Wikimedia sites.

Addshore closed this task as Resolved.Jun 13 2017, 11:47 AM

@Addshore @Tobi_WMDE_SW is this ticket done?

I believe so