Replace usages of Wikimedia\(suppress|restore)Warnings()

Change-Id: I601cf8d513bd1bbd305c6ad2250ba18b376fe819
This commit is contained in:
Reedy 2022-02-24 21:14:12 +00:00
parent efca55077c
commit b9b82c550f
2 changed files with 6 additions and 4 deletions

View file

@ -8,6 +8,7 @@
*/
use MediaWiki\MediaWikiServices;
use Wikimedia\AtEase\AtEase;
/**
* @ingroup Extensions
@ -337,13 +338,13 @@ class TitleBlacklist {
public function validate( array $blacklist ) {
$badEntries = [];
foreach ( $blacklist as $e ) {
Wikimedia\suppressWarnings();
AtEase::suppressWarnings();
$regex = $e->getRegex();
// @phan-suppress-next-line SecurityCheck-ReDoS
if ( preg_match( "/{$regex}/u", '' ) === false ) {
$badEntries[] = $e->getRaw();
}
Wikimedia\restoreWarnings();
AtEase::restoreWarnings();
}
return $badEntries;
}

View file

@ -9,6 +9,7 @@
use MediaWiki\Extension\AntiSpoof\AntiSpoof;
use MediaWiki\MediaWikiServices;
use Wikimedia\AtEase\AtEase;
/**
* @ingroup Extensions
@ -130,13 +131,13 @@ class TitleBlacklistEntry {
}
}
Wikimedia\suppressWarnings();
AtEase::suppressWarnings();
// @phan-suppress-next-line SecurityCheck-ReDoS
$match = preg_match(
"/^(?:{$this->mRegex})$/us" . ( isset( $this->mParams['casesensitive'] ) ? '' : 'i' ),
$title
);
Wikimedia\restoreWarnings();
AtEase::restoreWarnings();
if ( $match ) {
if ( isset( $this->mParams['moveonly'] ) && $action != 'move' ) {