mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-04 12:38:40 +00:00
Merge "Remove use of Revision::newFromTitle"
This commit is contained in:
commit
a048941208
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
use MediaWiki\Auth\AuthenticationRequest;
|
use MediaWiki\Auth\AuthenticationRequest;
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
|
use MediaWiki\Revision\RevisionAccessException;
|
||||||
|
use MediaWiki\Revision\RevisionLookup;
|
||||||
|
use MediaWiki\Revision\SlotRecord;
|
||||||
use Wikimedia\IPUtils;
|
use Wikimedia\IPUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1092,13 +1095,21 @@ class SimpleCaptcha {
|
||||||
* @return string
|
* @return string
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private function loadText( $title, $section, $flags = Revision::READ_LATEST ) {
|
private function loadText( $title, $section, $flags = RevisionLookup::READ_LATEST ) {
|
||||||
$rev = Revision::newFromTitle( $title, 0, $flags );
|
$revRecord = MediaWikiServices::getInstance()
|
||||||
if ( $rev === null ) {
|
->getRevisionLookup()
|
||||||
|
->getRevisionByTitle( $title, 0, $flags );
|
||||||
|
|
||||||
|
if ( $revRecord === null ) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $rev->getContent();
|
try {
|
||||||
|
$content = $revRecord->getContent( SlotRecord::MAIN );
|
||||||
|
} catch ( RevisionAccessException $e ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$text = ContentHandler::getContentText( $content );
|
$text = ContentHandler::getContentText( $content );
|
||||||
if ( $section !== '' ) {
|
if ( $section !== '' ) {
|
||||||
return MediaWikiServices::getInstance()->getParser()
|
return MediaWikiServices::getInstance()->getParser()
|
||||||
|
|
Loading…
Reference in a new issue