Revert "Replace depricating method IContextSource::getWikiPage && IContextSource::canUseWikiPage"

This reverts commit 0a221920ae.

Bug: T285959
Change-Id: Idc0d2beae2f73c15515041153daa831da5c29eaa
This commit is contained in:
Reedy 2021-07-01 15:54:36 +00:00
parent 0f01d41c9f
commit cedfdae4c5

View file

@ -851,10 +851,10 @@ class SimpleCaptcha {
* @return bool
*/
public function confirmEditMerged( $context, $content, $status, $summary, $user, $minorEdit ) {
$title = $context->getTitle();
if ( !$title->canExist() ) {
if ( !$context->canUseWikiPage() ) {
// we check WikiPage only
// try to get an appropriate title for this page
$title = $context->getTitle();
if ( $title instanceof Title ) {
$title = $title->getFullText();
} else {
@ -867,8 +867,7 @@ class SimpleCaptcha {
wfDebug( __METHOD__ . ': Skipped ConfirmEdit check: No WikiPage for title ' . $title );
return true;
}
$page = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromTitle( $title );
$page = $context->getWikiPage();
if ( !$this->doConfirmEdit( $page, $content, '', $context, $user ) ) {
$status->value = EditPage::AS_HOOK_ERROR_EXPECTED;
$status->apiHookResult = [];