Rename some variables to use more neutral language

Bug: T254646
Change-Id: I997625b8201dce2c257d20f96d00089e995c2b0d
This commit is contained in:
Reedy 2021-03-19 16:12:50 +00:00
parent 9bf6d806c1
commit bbe130b242
10 changed files with 33 additions and 33 deletions

View file

@ -96,7 +96,7 @@ class SpecialPageAction extends FormlessAction {
return null;
}
// map actions to (whitelisted) special pages
// map actions to (allowed) special pages
return MediaWikiServices::getInstance()->getSpecialPageFactory()->
getPage( self::$actionToSpecialPageMapping[$action] );
}

View file

@ -123,14 +123,14 @@ class ApiAuthManagerHelper {
/**
* Filter out authentication requests by class name
* @param AuthenticationRequest[] $reqs Requests to filter
* @param string[] $blacklist Class names to remove
* @param string[] $remove Class names to remove
* @return AuthenticationRequest[]
*/
public static function blacklistAuthenticationRequests( array $reqs, array $blacklist ) {
if ( $blacklist ) {
$blacklist = array_flip( $blacklist );
$reqs = array_filter( $reqs, static function ( $req ) use ( $blacklist ) {
return !isset( $blacklist[get_class( $req )] );
public static function blacklistAuthenticationRequests( array $reqs, array $remove ) {
if ( $remove ) {
$remove = array_flip( $remove );
$reqs = array_filter( $reqs, static function ( $req ) use ( $remove ) {
return !isset( $remove[get_class( $req )] );
} );
}
return $reqs;

View file

@ -59,14 +59,14 @@ class ApiRemoveAuthenticationData extends ApiBase {
// Fetch the request. No need to load from the request, so don't use
// ApiAuthManagerHelper's method.
$blacklist = $this->authAction === AuthManager::ACTION_REMOVE
$remove = $this->authAction === AuthManager::ACTION_REMOVE
? array_flip( $this->getConfig()->get( 'RemoveCredentialsBlacklist' ) )
: [];
$reqs = array_filter(
$manager->getAuthenticationRequests( $this->authAction, $this->getUser() ),
static function ( AuthenticationRequest $req ) use ( $params, $blacklist ) {
static function ( AuthenticationRequest $req ) use ( $params, $remove ) {
return $req->getUniqueId() === $params['request'] &&
!isset( $blacklist[get_class( $req )] );
!isset( $remove[get_class( $req )] );
}
);
if ( count( $reqs ) !== 1 ) {

View file

@ -363,12 +363,12 @@ class BlockManager {
* Whether the given IP is in a DNS blacklist.
*
* @param string $ip IP to check
* @param bool $checkWhitelist Whether to check the whitelist first
* @param bool $checkAllowed Whether to check $wgProxyWhitelist first
* @return bool True if blacklisted.
*/
public function isDnsBlacklisted( $ip, $checkWhitelist = false ) {
public function isDnsBlacklisted( $ip, $checkAllowed = false ) {
if ( !$this->options->get( 'EnableDnsBlacklist' ) ||
( $checkWhitelist && in_array( $ip, $this->options->get( 'ProxyWhitelist' ) ) )
( $checkAllowed && in_array( $ip, $this->options->get( 'ProxyWhitelist' ) ) )
) {
return false;
}

View file

@ -230,10 +230,10 @@ class JobQueueGroup {
*
* @param int|string $qtype JobQueueGroup::TYPE_* constant or job type string
* @param int $flags Bitfield of JobQueueGroup::USE_* constants
* @param array $blacklist List of job types to ignore
* @param array $ignored List of job types to ignore
* @return RunnableJob|bool Returns false on failure
*/
public function pop( $qtype = self::TYPE_DEFAULT, $flags = 0, array $blacklist = [] ) {
public function pop( $qtype = self::TYPE_DEFAULT, $flags = 0, array $ignored = [] ) {
global $wgJobClasses;
$job = false;
@ -247,7 +247,7 @@ class JobQueueGroup {
}
if ( is_string( $qtype ) ) { // specific job type
if ( !in_array( $qtype, $blacklist ) ) {
if ( !in_array( $qtype, $ignored ) ) {
$job = $this->get( $qtype )->pop();
}
} else { // any job in the "default" jobs types
@ -264,7 +264,7 @@ class JobQueueGroup {
$types = array_intersect( $types, $this->getDefaultQueueTypes() );
}
$types = array_diff( $types, $blacklist ); // avoid selected types
$types = array_diff( $types, $ignored ); // avoid selected types
shuffle( $types ); // avoid starvation
foreach ( $types as $type ) { // for each queue...

View file

@ -407,13 +407,13 @@ abstract class TablePager extends IndexPager {
* Resubmits all defined elements of the query string, except for a
* blacklist, passed in the $blacklist parameter.
*
* @param array $blacklist Parameters from the request query which should not be resubmitted
* @param array $noResubmit Parameters from the request query which should not be resubmitted
* @return string HTML fragment
*/
public function getHiddenFields( $blacklist = [] ) {
$blacklist = (array)$blacklist;
public function getHiddenFields( $noResubmit = [] ) {
$noResubmit = (array)$noResubmit;
$query = $this->getRequest()->getQueryValues();
foreach ( $blacklist as $name ) {
foreach ( $noResubmit as $name ) {
unset( $query[$name] );
}
$s = '';

View file

@ -57,14 +57,14 @@ class ResourceLoaderLessVarFileModule extends ResourceLoaderFileModule {
* Return a subset of messages from a JSON string representation.
*
* @param string $blob JSON
* @param string[] $whitelist
* @param string[] $allowed
* @return array
*/
private function pluckFromMessageBlob( $blob, array $whitelist ) : array {
private function pluckFromMessageBlob( $blob, array $allowed ) : array {
$data = json_decode( $blob, true );
// Keep only the messages intended for LESS export
// (opposite of getMesssages essentially).
return array_intersect_key( $data, array_flip( $whitelist ) );
return array_intersect_key( $data, array_flip( $allowed ) );
}
/**

View file

@ -2161,7 +2161,7 @@ abstract class UploadBase {
* @return string[] List of prefixes
*/
public static function getFilenamePrefixBlacklist() {
$blacklist = [];
$list = [];
$message = wfMessage( 'filename-prefix-blacklist' )->inContentLanguage();
if ( !$message->isDisabled() ) {
$lines = explode( "\n", $message->plain() );
@ -2176,11 +2176,11 @@ abstract class UploadBase {
if ( $comment > 0 ) {
$line = substr( $line, 0, $comment - 1 );
}
$blacklist[] = trim( $line );
$list[] = trim( $line );
}
}
return $blacklist;
return $list;
}
/**

View file

@ -86,12 +86,12 @@ class UploadFromUrl extends UploadBase {
$valid = false;
foreach ( $wgCopyUploadsDomains as $domain ) {
// See if the domain for the upload matches this whitelisted domain
$whitelistedDomainPieces = explode( '.', $domain );
$domainPieces = explode( '.', $domain );
$uploadDomainPieces = explode( '.', $parsedUrl['host'] );
if ( count( $whitelistedDomainPieces ) === count( $uploadDomainPieces ) ) {
if ( count( $domainPieces ) === count( $uploadDomainPieces ) ) {
$valid = true;
// See if all the pieces match or not (excluding wildcards)
foreach ( $whitelistedDomainPieces as $index => $piece ) {
foreach ( $domainPieces as $index => $piece ) {
if ( $piece !== '*' && $piece !== $uploadDomainPieces[$index] ) {
$valid = false;
}

View file

@ -150,9 +150,9 @@ class UserNameUtils implements UserRigorOptions {
return false;
}
// Check an additional blacklist of troublemaker characters.
// Check an additional list of troublemaker characters.
// Should these be merged into the title char list?
$unicodeBlacklist = '/[' .
$unicodeList = '/[' .
'\x{0080}-\x{009f}' . # iso-8859-1 control chars
'\x{00a0}' . # non-breaking space
'\x{2000}-\x{200f}' . # various whitespace
@ -160,7 +160,7 @@ class UserNameUtils implements UserRigorOptions {
'\x{3000}' . # ideographic space
'\x{e000}-\x{f8ff}' . # private use
']/u';
if ( preg_match( $unicodeBlacklist, $name ) ) {
if ( preg_match( $unicodeList, $name ) ) {
return false;
}