Index: trunk/phase3/includes/Article.php |
— | — | @@ -1421,7 +1421,7 @@ |
1422 | 1422 | * to MediaWiki's performance-optimised locking strategy. |
1423 | 1423 | * @param $baseRevId, the revision ID this edit was based off, if any |
1424 | 1424 | * |
1425 | | - * @return bool success |
| 1425 | + * @return int Current revision ID after this edit |
1426 | 1426 | */ |
1427 | 1427 | function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) { |
1428 | 1428 | global $wgUser, $wgDBtransactions, $wgUseAutomaticEditSummaries; |
— | — | @@ -1522,6 +1522,7 @@ |
1523 | 1523 | if( !$ok ) { |
1524 | 1524 | /* Belated edit conflict! Run away!! */ |
1525 | 1525 | $good = false; |
| 1526 | + $revisionId = 0; |
1526 | 1527 | $dbw->rollback(); |
1527 | 1528 | } else { |
1528 | 1529 | wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $revision, $baseRevId ) ); |
— | — | @@ -1621,7 +1622,7 @@ |
1622 | 1623 | } |
1623 | 1624 | |
1624 | 1625 | wfProfileOut( __METHOD__ ); |
1625 | | - return $good; |
| 1626 | + return $revisionId; |
1626 | 1627 | } |
1627 | 1628 | |
1628 | 1629 | /** |
— | — | @@ -2474,7 +2475,7 @@ |
2475 | 2476 | |
2476 | 2477 | # Check permissions |
2477 | 2478 | $errors = array_merge( $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ), |
2478 | | - $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser ) ); |
| 2479 | + $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser ) ); |
2479 | 2480 | if( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) ) |
2480 | 2481 | $errors[] = array( 'sessionfailure' ); |
2481 | 2482 | |
— | — | @@ -2578,12 +2579,13 @@ |
2579 | 2580 | # Save |
2580 | 2581 | $flags = EDIT_UPDATE; |
2581 | 2582 | |
2582 | | - if ($wgUser->isAllowed('minoredit')) |
| 2583 | + if( $wgUser->isAllowed('minoredit') ) |
2583 | 2584 | $flags |= EDIT_MINOR; |
2584 | 2585 | |
2585 | 2586 | if( $bot && ($wgUser->isAllowed('markbotedits') || $wgUser->isAllowed('bot')) ) |
2586 | 2587 | $flags |= EDIT_FORCE_BOT; |
2587 | | - $this->doEdit( $target->getText(), $summary, $flags, $target->getId() ); |
| 2588 | + # Actually store the edit |
| 2589 | + $revId = $this->doEdit( $target->getText(), $summary, $flags, $target->getId() ); |
2588 | 2590 | |
2589 | 2591 | wfRunHooks( 'ArticleRollbackComplete', array( $this, $wgUser, $target ) ); |
2590 | 2592 | |
— | — | @@ -2591,6 +2593,7 @@ |
2592 | 2594 | 'summary' => $summary, |
2593 | 2595 | 'current' => $current, |
2594 | 2596 | 'target' => $target, |
| 2597 | + 'newid' => $revId |
2595 | 2598 | ); |
2596 | 2599 | return array(); |
2597 | 2600 | } |
— | — | @@ -2618,7 +2621,7 @@ |
2619 | 2622 | $wgOut->rateLimited(); |
2620 | 2623 | return; |
2621 | 2624 | } |
2622 | | - if( isset( $result[0][0] ) && ( $result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback' ) ){ |
| 2625 | + if( isset( $result[0][0] ) && ( $result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback' ) ) { |
2623 | 2626 | $wgOut->setPageTitle( wfMsg( 'rollbackfailed' ) ); |
2624 | 2627 | $errArray = $result[0]; |
2625 | 2628 | $errMsg = array_shift( $errArray ); |
— | — | @@ -2626,7 +2629,8 @@ |
2627 | 2630 | if( isset( $details['current'] ) ){ |
2628 | 2631 | $current = $details['current']; |
2629 | 2632 | if( $current->getComment() != '' ) { |
2630 | | - $wgOut->addWikiMsgArray( 'editcomment', array( $wgUser->getSkin()->formatComment( $current->getComment() ) ), array( 'replaceafter' ) ); |
| 2633 | + $wgOut->addWikiMsgArray( 'editcomment', array( |
| 2634 | + $wgUser->getSkin()->formatComment( $current->getComment() ) ), array( 'replaceafter' ) ); |
2631 | 2635 | } |
2632 | 2636 | } |
2633 | 2637 | return; |
— | — | @@ -2653,6 +2657,7 @@ |
2654 | 2658 | |
2655 | 2659 | $current = $details['current']; |
2656 | 2660 | $target = $details['target']; |
| 2661 | + $newId = $details['newid']; |
2657 | 2662 | $wgOut->setPageTitle( wfMsg( 'actioncomplete' ) ); |
2658 | 2663 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
2659 | 2664 | $old = $wgUser->getSkin()->userLink( $current->getUser(), $current->getUserText() ) |
— | — | @@ -2663,7 +2668,7 @@ |
2664 | 2669 | $wgOut->returnToMain( false, $this->mTitle ); |
2665 | 2670 | |
2666 | 2671 | if( !$wgRequest->getBool( 'hidediff', false ) ) { |
2667 | | - $de = new DifferenceEngine( $this->mTitle, $current->getId(), 'next', false, true ); |
| 2672 | + $de = new DifferenceEngine( $this->mTitle, $current->getId(), $newId, false, true ); |
2668 | 2673 | $de->showDiff( '', '' ); |
2669 | 2674 | } |
2670 | 2675 | } |