Sometimes, when a page is deleted and restored, its `page_id` may change https://www.mediawiki.org/wiki/Manual:Page_table#page_id
MediaInfo data for a slot on a File page is stored in a json blob, and that json blob contains an id for the MediaInfo item that is based on the `page_id` of the File page. So, for example, if a page with `page_id=1234` has MediaInfo data in a slot, the MediaInfo item will contain the field `"id": "M1234"`
If a File page is deleted and restored, and its `page_id` changes, then the json blob is **not** updated, and so the MediaInfo item's id no longer corresponds to the `page_id`. The MediaInfo blob can still be retrieved from the db, because the query to retrieve it is based on the `page_id` of the File page and the table keys are updated during the page restore, but the `"id"` value in the json is wrong.
Until recently, this discrepancy caused a fatal error. [[ https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikibaseMediaInfo/+/534218 | This patch ]] replaces the fatal error with a warning
The problem remains, however, that statements on the File page cannot be edited, and an attempt to edit via the File page UI (which uses the api call `wbsetclaim`) fails
Example request:
```
action wbsetclaim
format json
claim {
"type": "statement",
"mainsnak": {
"snaktype": "value",
"property": "P737",
"datavalue": {
"type": "wikibase-entityid",
"value": {
"id": "Q72"
}
}
},
"id": "M5677$e3e5035d-4be7-fbf6-c032-e7363c017e58",
"rank": "preferred"
}
bot 1
assertuser Admin
token 0a08e306d7c92d93fd545e0317f2eb375d70f00c+\
```
Example response:
```
"error": {
"code": "editconflict",
"info": "Edit conflict. Could not patch the current revision.",
"messages": [{
"name": "wikibase-api-editconflict",
"parameters": [],
"html": {
"*": "Edit conflict. Could not patch the current revision."
}
}, {
"name": "edit-conflict",
"parameters": [],
"html": {
"*": "Edit conflict."
}
}],
"*": "See http://127.0.0.1:8080/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
}
```
... and if `baserevid` is removed from the request params sent to `wbsetclaim` then there is no error, but the claim **is added to the page with `page_id` equal to the numeric part of the MediaInfo id instead of modifying the original MediaInfo item**