* to MediaWiki's performance-optimised locking strategy.
* @param $baseRevId, the revision ID this edit was based off, if any
*
- * @return bool success
+ * @return int Current revision ID after this edit
*/
function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) {
global $wgUser, $wgDBtransactions, $wgUseAutomaticEditSummaries;
if( !$ok ) {
/* Belated edit conflict! Run away!! */
$good = false;
+ $revisionId = 0;
$dbw->rollback();
} else {
wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $revision, $baseRevId ) );
}
wfProfileOut( __METHOD__ );
- return $good;
+ return $revisionId;
}
/**
# Check permissions
$errors = array_merge( $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ),
- $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser ) );
+ $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser ) );
if( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) )
$errors[] = array( 'sessionfailure' );
# Save
$flags = EDIT_UPDATE;
- if ($wgUser->isAllowed('minoredit'))
+ if( $wgUser->isAllowed('minoredit') )
$flags |= EDIT_MINOR;
if( $bot && ($wgUser->isAllowed('markbotedits') || $wgUser->isAllowed('bot')) )
$flags |= EDIT_FORCE_BOT;
- $this->doEdit( $target->getText(), $summary, $flags, $target->getId() );
+ # Actually store the edit
+ $revId = $this->doEdit( $target->getText(), $summary, $flags, $target->getId() );
wfRunHooks( 'ArticleRollbackComplete', array( $this, $wgUser, $target ) );
'summary' => $summary,
'current' => $current,
'target' => $target,
+ 'newid' => $revId
);
return array();
}
$wgOut->rateLimited();
return;
}
- if( isset( $result[0][0] ) && ( $result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback' ) ){
+ if( isset( $result[0][0] ) && ( $result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback' ) ) {
$wgOut->setPageTitle( wfMsg( 'rollbackfailed' ) );
$errArray = $result[0];
$errMsg = array_shift( $errArray );
if( isset( $details['current'] ) ){
$current = $details['current'];
if( $current->getComment() != '' ) {
- $wgOut->addWikiMsgArray( 'editcomment', array( $wgUser->getSkin()->formatComment( $current->getComment() ) ), array( 'replaceafter' ) );
+ $wgOut->addWikiMsgArray( 'editcomment', array(
+ $wgUser->getSkin()->formatComment( $current->getComment() ) ), array( 'replaceafter' ) );
}
}
return;
$current = $details['current'];
$target = $details['target'];
+ $newId = $details['newid'];
$wgOut->setPageTitle( wfMsg( 'actioncomplete' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$old = $wgUser->getSkin()->userLink( $current->getUser(), $current->getUserText() )
$wgOut->returnToMain( false, $this->mTitle );
if( !$wgRequest->getBool( 'hidediff', false ) ) {
- $de = new DifferenceEngine( $this->mTitle, $current->getId(), 'next', false, true );
+ $de = new DifferenceEngine( $this->mTitle, $current->getId(), $newId, false, true );
$de->showDiff( '', '' );
}
}