== Task ==
**Motivation**
When moving files, all local links either become red links or point to different pages. However, we want to be able to persist where links lead to, too.
**Acceptance Criteria**
[] For links to local wiki pages, add the corresponding interwiki description. I.e. [[1st Security Force Assistance Brigade]] should be changed to [[:en:1st Security Force Assistance Brigade|1st Security Force Assistance Brigade]]
[] Links to user pages should link to the Commons accounts, if they exist, this can just stay a local link
[] If the linked user does not have a Commons account, link to the source wiki account. This can be done either through interwiki linking or using the `User at project` template, but either way it should be possible to see from the link that you are leaving Commons by clicking on it.
== Original Report ==
I've been playing around with the FileImporter tool a bit, and noticed that it causes lots of redlinks because it doesn't update wikilinks to point to the originating wiki. This can be fixed manually, but it would make sense for the tool to do this automatically. For example, I imported the file [[https://meta.wikimedia.org/wiki/File:1st_Security_Force_Assistance_Brigade_Flash.svg|:File:1st Security Force Assistance Brigade Flash.svg]], and had to manually change [[1st Security Force Assistance Brigade]] to [[:en:1st Security Force Assistance Brigade|1st Security Force Assistance Brigade]], [[United States military beret flash|unit flash]] to [[:en:United States military beret flash|unit flash]], and [[User:McChizzle]] to {{User at project|McChizzle|w|en}}.
It seems like it should be a fairly easy task to add the originating wiki's interwiki code and to pipe wikilinks that now need piping to hide the code. Detecting usernames and using {{User at project}} would be useful too.
Bonus points if the code is smart enough to only do it to redlinks.