Page MenuHomePhabricator

Add wikibase entity id for image files to media endpoint
Closed, ResolvedPublic

Description

Background information

Due to the file captions work it will be useful to have the entity id (M + pageid) in the media response so that it's available if the user wants to edit a caption.

How

"items": [
    {
      "section_id": 0,
      "type": "image",
      "showInGallery": true,
      "wb_entity_id": "M2780533",
      ...
    }
]

Event Timeline

JoeWalsh created this task.Mar 29 2019, 7:10 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 29 2019, 7:10 PM
JoeWalsh renamed this task from Add entity id for image files to media endpoint to Add wikibase entity id for image files to media endpoint.Mar 29 2019, 7:11 PM
JoeWalsh updated the task description. (Show Details)Mar 29 2019, 7:13 PM
JoeWalsh updated the task description. (Show Details)
Dbrant added a subscriber: Dbrant.Mar 29 2019, 7:15 PM
JoeWalsh updated the task description. (Show Details)Mar 29 2019, 7:29 PM

Here's why this is a bit more troublesome than one would think: the Commons entity IDs for files are based on their Commons page IDs, and for /page/media we make our imageinfo calls to the local Wikipedias and not Commons. We do this because Commons doesn't actually host all media files, but only the freely licensed ones. Fair-use media content is hosted directly on the wikis of projects that allow it. We can get imageinfo about all files used on a Wikipedia when querying it for imageinfo because Commons is searched as a fallback for files not hosted locally, but when querying Commons directly, there is no fallback. So just querying Commons in all cases won't work. (Also, note that because not all files are Commons-hosted, not every item will have a wb_entity_id when this is implemented.)

It won't be difficult to add a query to gather pageids and merge them into the endpoint response; it's just that /page/media is already painfully slow, and this will make it slower. Even that's probably not the end of the world; really, this is mostly just background for future reference.

Change 500145 had a related patch set uploaded (by Mholloway; owner: Michael Holloway):
[mediawiki/services/mobileapps@master] Add Commons Wikibase entity IDs to media response

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

Mholloway added a comment.EditedMar 29 2019, 10:54 PM

It doesn't seem like data exists in the DB for many of the files yet... most that I have tried come up as missing: true.

Change 500145 merged by jenkins-bot:
[mediawiki/services/mobileapps@master] Add Commons Wikibase entity IDs to media response

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

Mholloway triaged this task as Normal priority.Apr 5 2019, 7:23 PM

Mentioned in SAL (#wikimedia-operations) [2019-04-08T20:05:49Z] <bsitzmann@deploy1001> Started deploy [mobileapps/deploy@c7fa522]: Update mobileapps to cdb9928 (T220045 T219411 T219667)

Mentioned in SAL (#wikimedia-releng) [2019-04-08T20:06:04Z] <bearND> (beta): Update mobileapps to cdb9928 (T220045 T219411 T219667)

Mentioned in SAL (#wikimedia-operations) [2019-04-08T20:07:59Z] <bsitzmann@deploy1001> Finished deploy [mobileapps/deploy@c7fa522]: Update mobileapps to cdb9928 (T220045 T219411 T219667) (duration: 02m 10s)

Mentioned in SAL (#wikimedia-operations) [2019-04-08T20:41:06Z] <bsitzmann@deploy1001> Started deploy [mobileapps/deploy@c7fa522]: Update mobileapps to cdb9928 (T220045 T219411 T219667)

Mentioned in SAL (#wikimedia-operations) [2019-04-08T20:49:01Z] <bsitzmann@deploy1001> Finished deploy [mobileapps/deploy@c7fa522]: Update mobileapps to cdb9928 (T220045 T219411 T219667) (duration: 07m 55s)

Mentioned in SAL (#wikimedia-releng) [2019-04-09T16:21:14Z] <bearND> (beta): Update mobileapps to 3edfcad (T220045 T219411 T219667) - 3rd time is the charm

Mentioned in SAL (#wikimedia-operations) [2019-04-09T17:15:26Z] <bsitzmann@deploy1001> Started deploy [mobileapps/deploy@b04c397]: Update mobileapps to 3edfcad (T220045 T219411 T219667)

Mentioned in SAL (#wikimedia-operations) [2019-04-09T17:19:16Z] <bsitzmann@deploy1001> Finished deploy [mobileapps/deploy@b04c397]: Update mobileapps to 3edfcad (T220045 T219411 T219667) (duration: 03m 50s)

bearND closed this task as Resolved.Apr 9 2019, 6:16 PM
bearND added a subscriber: bearND.

It took a few tries but it's finally deployed now. See P8371 for the deployment issues yesterday.