Last modified: 2013-08-01 09:58:05 UTC
It should be possible to do undo operations through the API on items and other entities. This is currently blocked because the present diff/patch solution is line based. If we implement our own wbundo it could be nice to support reset/rollback etc through the same interface.
The line based diff is only a problem, when the undo rev needs merge. But it works for gui, so there should not be a problem to have it in api
Investigate whether the API action edit works with the undo and undoafter parameters does already work or not. This might already be working.
Specifically, the API should be using the EditEntityAction class to perform these actions on Wikibase entitites.
I poked at this a bit; as it turns out, ApiEditPage has it's own undo logic. So instead of diverting that (as suggested above) into Wikibase\EditEntityAction somehow, we should implement EntityContent::getUndoContent() based on EntityDiffer. Note that WikibaseHooks::onApiCheckCanExecute currently prevents ApiEditPage from working on wikibase entities. We'll need to make an exception there: if ( isset( $params['undo'] ) && $params['undo'] > 0 ) { // We don't allow direct editing, but direct undoing is ok! return true; }
Change 73942 had a related patch set uploaded by Daniel Kinzler: (bug 46352) Implement EntityHandler::getUndoContent https://gerrit.wikimedia.org/r/73942
Change 73942 merged by jenkins-bot: (bug 46352) Implement EntityHandler::getUndoContent https://gerrit.wikimedia.org/r/73942
Verified in Wikidata demo July 31th.