Page MenuHomePhabricator

Cannot clear MediaInfo entities
Closed, ResolvedPublic

Description

The clear boolean parameter of the wbeditentity API apparently cannot be used on MediaInfo entities:

{
    "error": {
        "code": "param-illegal",
        "info": "An illegal set of parameters have been used.",
        "messages": [
            {
                "name": "wikibase-api-param-illegal",
                "parameters": [],
                "html": {
                    "*": "An illegal set of parameters have been used."
                }
            }
        ]
    }
}

I assume this is because the MediaInfo class doesn’t implement the ClearableEntity interface. It had a clear() method for a while, but that was removed in T204488 (cc @Cparle, @Addshore).

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

My motivation for this is that I’m trying to write browser tests for the AC/DC gadget, for which I need a way to reset an entity to a known good state before I start editing it. As far as I can tell, there’s currently no good way to do that – I can’t find a “restore” in the API, and without the clear parameter, I’d have to explicitly remove all the statements in wbeditentity.

Change 538424 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseMediaInfo@master] Make MediaInfo implement ClearableEntity

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

I’d have to explicitly remove all the statements in wbeditentity.

…which I’ve now implemented (source)

Change 538424 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Make MediaInfo implement ClearableEntity

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

This is working as expected on Beta Commons now (example edit).