Page MenuHomePhabricator

VisualEditor: Search for images from fileRepos, rather than hard-coding use of local and Commons
Closed, ResolvedPublic

Description

ve.init.mw.Platform.js currently hard-codes searching from Commons, even if the wiki doesn't actually load images from Commons. We should do this based on wiki config instead.


Version: unspecified
Severity: minor

Details

Reference
bz50673

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:08 AM
bzimport set Reference to bz50673.

Ideally we'd avoid hardcoding Commons entirely and instead of exporting isInstantCommons, we'd export fileRepos. That should be almost as easy to do and would fix other things as well:

  • Wikis where their repo is Commons but through their own wgForeignFileRepos setting (e.g. like on WMF where we use more fine-tuned configuration that does essentially the same, or wikis that configure it but don't use wgUseInstantCommons because they want to set different parameters (e.g. disable repo[fetchDescription] or use a non-default repo[cacheExpiry]).
  • Wikis with more than 2 repositories.
  • Wikis working with other repos (e.g. a wiki farm might have their own commons-like thing).

Especially reason #1 since we do use InstantCommons in production but not the default settings through the UseInstantCommons toggle. We could hardcode some detection and export "isUsingCommonsAsARepoSomehow", but might as well take a few more minutes and figure out how to just export an array of api urls.

(In reply to comment #1)

Ideally we'd avoid hardcoding Commons entirely and instead of exporting
isInstantCommons, we'd export fileRepos.

Indeed; that was what I was thinking when I wrote this bug. Title modified to be clearer.

humpface wrote:

This was very frustrating for my work's internal wiki. First, I didn't want any Instant Common images (and thanks to James, I was able to remove the line of code). However, since I disabled the use of Instant Commons ($wgUseInstantCommons = false;), I was still able to search through the Instant Commons but after saving, everything showed up as a broken link.

Suggestion:

  • Tie the JSON mediaSources object in ve.init.ms.Platform.js to the $wgUseInstantCommons (i.e., if Commons is turned off in LocalSettings.php, then a user can't search through the images).

This can now be done by using the new meta=filerepoinfo API query, which was introduced into core in gerrit 85344.

Change 102377 had a related patch set uploaded by Mooeypoo:
Use image sources from API's fileRepo

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

Change 102377 merged by jenkins-bot:
Use image sources from the fileRepo API

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