Okay, the first line of the edit above should instead be:
Code:
if ($_REQUEST['action'] == 'rollback')
Since the form submits the correct revision ID, it doesn't need to be rolled back on the 'dorollback' action.
The purge fatal error occurs when you attempt to purge the current revision, and the current revision is actually a duplicate of the version right before it (like if it's a "reverted" entry). However, the number of cases where this occurs should ideally be significantly lower than it does now - you should only need to purge the current revision, and it should not create a "reverted" entry, but this is not possible to fix with the current database structure. This is something we plan to address in VaultWiki 4.
In order to prevent the error from occurring when purging the duplicate entry, in
vault/dm/revision.php, find:
Code:
$this->info['roll_back'] = $target['revisionid'];
if ($doquery)
{
$threadinfo = fetch_threadinfo($this->existing['threadid']);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
$post = fetch_postinfo($threadinfo['firstpostid']);
require_once(DIR . '/vault/functions/rollback.php');
$rolldata = revision_history_rollback($target, $foruminfo, $threadinfo, $post, array(
'is_automated'
));
if (!empty($rolldata->errors))
{
eval(standard_error(implode('<br />', $rolldata->errors)));
}
unset($rolldata);
}
Replace with:
Code:
if ($target['revisionid'] == $this->existing['rollback'])
{
// do nothing, purged was duplicate of target
}
else
{
$this->info['roll_back'] = $target['revisionid'];
if ($doquery)
{
$threadinfo = fetch_threadinfo($this->existing['threadid']);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
$post = fetch_postinfo($threadinfo['firstpostid']);
require_once(DIR . '/vault/functions/rollback.php');
$rolldata = revision_history_rollback($target, $foruminfo, $threadinfo, $post, array(
'is_automated'
));
if (!empty($rolldata->errors))
{
eval(standard_error(implode('<br />', $rolldata->errors)));
}
unset($rolldata);
}
}
This will not catch all cases. Like if you had 5 edits, like so:
- A
- B (purged)
- A (reverted)
- C (purged)
- A (reverted)
In this scenario, purging the following order 2, 4, 3, 5 will result in the same error because 5 was not recorded as identical to 1 but rather to 3. All cases will actually not throw a stop error in the next release because of a fix for a related bug:
http://www.vaultwiki.org/issues/2000/ Instead they will die quietly without creating a duplicate revision, but performing the purge.