diff --git a/extension.json b/extension.json index 94db8381..d62a7a45 100644 --- a/extension.json +++ b/extension.json @@ -10,7 +10,7 @@ "descriptionmsg": "replacetext-desc", "license-name": "GPL-2.0-or-later", "requires": { - "MediaWiki": ">= 1.35.0" + "MediaWiki": ">= 1.40.0" }, "type": "specialpage", "GroupPermissions": { diff --git a/src/Job.php b/src/Job.php index c75b1e0f..d8d638e8 100644 --- a/src/Job.php +++ b/src/Job.php @@ -28,9 +28,7 @@ use RecentChange; use RequestContext; use TextContent; use Title; -use WatchAction; use Wikimedia\ScopedCallback; -use WikiPage; use WikitextContent; /** @@ -100,24 +98,10 @@ class Job extends JobParent { } if ( $this->params['watch_page'] ) { - if ( method_exists( \MediaWiki\Watchlist\WatchlistManager::class, 'addWatch' ) ) { - // MW 1.37+ - $services->getWatchlistManager()->addWatch( $current_user, $new_title ); - } else { - // Method was removed, but we only invoke it in versions its - // still available, suppress phan error - // @phan-suppress-next-line PhanUndeclaredStaticMethod - WatchAction::doWatch( $new_title, $current_user ); - } - + $services->getWatchlistManager()->addWatch( $current_user, $new_title ); } } else { - if ( method_exists( MediaWikiServices::class, 'getWikiPageFactory' ) ) { - // MW 1.36+ - $wikiPage = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromTitle( $this->title ); - } else { - $wikiPage = new WikiPage( $this->title ); - } + $wikiPage = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromTitle( $this->title ); $latestRevision = $wikiPage->getRevisionRecord(); if ( $latestRevision === null ) { diff --git a/src/SpecialReplaceText.php b/src/SpecialReplaceText.php index 7f82a5c1..89542857 100644 --- a/src/SpecialReplaceText.php +++ b/src/SpecialReplaceText.php @@ -21,7 +21,6 @@ namespace MediaWiki\Extension\ReplaceText; use ErrorPageError; use Html; -use JobQueueGroup; use Language; use MediaWiki\Linker\LinkRenderer; use MediaWiki\MediaWikiServices; @@ -188,13 +187,7 @@ class SpecialReplaceText extends SpecialPage { $jobs = $this->createJobsForTextReplacements(); $services = MediaWikiServices::getInstance(); - if ( method_exists( $services, 'getJobQueueGroup' ) ) { - // MW 1.37+ - $services->getJobQueueGroup()->push( $jobs ); - } else { - // @phan-suppress-next-line PhanUndeclaredStaticMethod - JobQueueGroup::singleton()->push( $jobs ); - } + $services->getJobQueueGroup()->push( $jobs ); $count = $this->getLanguage()->formatNum( count( $jobs ) ); $out->addWikiMsg(