Use MovePageFactory to instance MovePage

Constructor is deprecated
MovePageFactory since 1.35

Change-Id: Iefec53267f6ed4a179f537adb67d744b3b47ea2b
This commit is contained in:
Umherirrender 2021-10-14 20:39:58 +02:00
parent 4a0a3e9c5d
commit f8f8dfca4a
3 changed files with 4 additions and 5 deletions

View file

@ -10,7 +10,7 @@
"descriptionmsg": "replacetext-desc",
"license-name": "GPL-2.0-or-later",
"requires": {
"MediaWiki": ">= 1.34.0"
"MediaWiki": ">= 1.35.0"
},
"type": "specialpage",
"GroupPermissions": {

View file

@ -23,7 +23,6 @@ namespace MediaWiki\Extension\ReplaceText;
use Job as JobParent;
use MediaWiki\MediaWikiServices;
use MovePage;
use RequestContext;
use Title;
use User;
@ -89,7 +88,7 @@ class Job extends JobParent {
$reason = $this->params['edit_summary'];
$create_redirect = $this->params['create_redirect'];
$mvPage = new MovePage( $this->title, $new_title );
$mvPage = MediaWikiServices::getInstance()->getMovePageFactory()->newMovePage( $this->title, $new_title );
$mvStatus = $mvPage->move( $current_user, $reason, $create_redirect );
if ( !$mvStatus->isOK() ) {
$this->error = "replaceText: error while moving: " . $this->title->getPrefixedDBkey() .

View file

@ -23,7 +23,6 @@ use ErrorPageError;
use Html;
use JobQueueGroup;
use MediaWiki\MediaWikiServices;
use MovePage;
use OOUI;
use PermissionsError;
use SpecialPage;
@ -347,6 +346,7 @@ class SpecialReplaceText extends SpecialPage {
$this->use_regex
);
$movePageFactory = MediaWikiServices::getInstance()->getMovePageFactory();
foreach ( $res as $row ) {
$title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
if ( $title == null ) {
@ -360,7 +360,7 @@ class SpecialReplaceText extends SpecialPage {
$this->use_regex
);
$mvPage = new MovePage( $title, $new_title );
$mvPage = $movePageFactory->newMovePage( $title, $new_title );
$moveStatus = $mvPage->isValidMove();
$permissionStatus = $mvPage->checkPermissions( $this->getUser(), null );