Page MenuHomePhabricator

Undo operations in the Wikibase API
Closed, ResolvedPublic

Description

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.


Version: unspecified
Severity: normal

Details

Reference
bz46352

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:32 AM
bzimport set Reference to bz46352.
bzimport added a subscriber: Unknown Object (MLST).

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.