X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiEditPage.php;h=1936407ac330ce707d3de5e2744d55de51d0ef17;hb=de64366f58f0af7a02a417833c8e0605e4140fab;hp=fdf9cf1bf97a3d13c2d62b546aff5fe5def92617;hpb=13f4dfb519ebdc75b39109c11d31868faa56d49c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index fdf9cf1bf9..1936407ac3 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -20,7 +20,8 @@ * @file */ -use MediaWiki\Storage\RevisionRecord; +use MediaWiki\MediaWikiServices; +use MediaWiki\Revision\RevisionRecord; /** * A module that allows for editing and creating pages. @@ -239,11 +240,15 @@ class ApiEditPage extends ApiBase { $params['text'] = $newContent->serialize( $contentFormat ); // If no summary was given and we only undid one rev, // use an autosummary - if ( is_null( $params['summary'] ) && - $titleObj->getNextRevisionID( $undoafterRev->getId() ) == $params['undo'] - ) { - $params['summary'] = wfMessage( 'undo-summary' ) - ->params( $params['undo'], $undoRev->getUserText() )->inContentLanguage()->text(); + + if ( is_null( $params['summary'] ) ) { + $nextRev = MediaWikiServices::getInstance()->getRevisionLookup() + ->getNextRevision( $undoafterRev->getRevisionRecord() ); + if ( $nextRev && $nextRev->getId() == $params['undo'] ) { + $params['summary'] = wfMessage( 'undo-summary' ) + ->params( $params['undo'], $undoRev->getUserText() ) + ->inContentLanguage()->text(); + } } }