Go to the documentation of this file.
57 $this->mRegex = $regex;
67 global $wgTitleBlacklistUsernameSources;
69 if ( $wgTitleBlacklistUsernameSources ===
'*' ) {
73 if ( !$wgTitleBlacklistUsernameSources ) {
77 if ( !is_array( $wgTitleBlacklistUsernameSources ) ) {
79 '$wgTitleBlacklistUsernameSources must be "*", false or an array' );
82 return in_array( $this->mSource, $wgTitleBlacklistUsernameSources,
true );
102 if ( isset( $this->mParams[
'antispoof'] )
103 && is_callable(
'AntiSpoof::checkUnicodeString' )
105 if ( $action ===
'edit' ) {
108 list( $ok, $norm ) =
$cache->getWithSetCallback(
109 $cache->makeKey(
'titleblacklist',
'normalized-unicode', md5(
$title ) ),
112 return AntiSpoof::checkUnicodeString(
$title );
114 [
'pcTTL' => $cache::TTL_PROC_LONG ]
117 list( $ok, $norm ) = AntiSpoof::checkUnicodeString(
$title );
120 if ( $ok ===
"OK" ) {
121 list( $ver,
$title ) = explode(
':', $norm, 2 );
123 wfDebugLog(
'TitleBlacklist',
'AntiSpoof could not normalize "' .
$title .
'".' );
129 "/^(?:{$this->mRegex})$/us" . ( isset( $this->mParams[
'casesensitive'] ) ?
'' :
'i' ),
135 if ( isset( $this->mParams[
'moveonly'] ) && $action !=
'move' ) {
138 if ( isset( $this->mParams[
'newaccountonly'] ) && $action !=
'new-account' ) {
141 if ( !isset( $this->mParams[
'noedit'] ) && $action ==
'edit' ) {
144 if ( isset( $this->mParams[
'reupload'] ) && $action ==
'upload' ) {
165 $line = preg_replace(
"/^\\s*([^#]*)\\s*((.*)?)$/",
"\\1",
$line );
168 if (
$line ===
'' ) {
173 if ( !preg_match(
'/^(.*?)(\s*<([^<>]*)>)?$/',
$line, $pockets ) ) {
176 $regex = trim( $pockets[1] );
177 $regex = str_replace(
'_',
' ', $regex );
178 $opts_str = isset( $pockets[3] ) ? trim( $pockets[3] ) :
'';
180 $opts = preg_split(
'/\s*\|\s*/', $opts_str );
181 foreach ( $opts
as $opt ) {
182 $opt2 = strtolower(
$opt );
183 if ( $opt2 ==
'autoconfirmed' ) {
186 if ( $opt2 ==
'moveonly' ) {
189 if ( $opt2 ==
'newaccountonly' ) {
192 if ( $opt2 ==
'noedit' ) {
195 if ( $opt2 ==
'casesensitive' ) {
198 if ( $opt2 ==
'reupload' ) {
201 if ( preg_match(
'/errmsg\s*=\s*(.+)/i',
$opt,
$matches ) ) {
204 if ( $opt2 ==
'antispoof' ) {
209 preg_match_all(
'/{{\s*([a-z]+)\s*:\s*(.+?)\s*}}/', $regex, $magicwords, PREG_SET_ORDER );
210 foreach ( $magicwords
as $mword ) {
212 switch ( strtolower( $mword[1] ) ) {
215 if ( is_string( $cpf_result ) ) {
217 $regex = str_replace( $mword[0], $cpf_result, $regex );
221 $cpf_result =
wfMessage( $mword[2] )->inContentLanguage()->text();
222 if ( is_string( $cpf_result ) ) {
223 $regex = str_replace( $mword[0], $cpf_result, $regex );
260 return isset( $this->mParams[
'errmsg'] ) ? $this->mParams[
'errmsg'] :
null;
276 $this->mFormatVersion = $v;
291 return $message ? $message :
"titleblacklist-forbidden-{$operation}";
setFormatVersion( $v)
Set the format version.
string $mFormatVersion
Entry format version.
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
getErrorMessage( $operation)
Return the error message name for the blacklist entry.
array $mParams
Parameters for this entry.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
filtersNewAccounts()
Returns whether this entry is capable of filtering new accounts.
namespace and then decline to actually register it file or subcat img or subcat $title
string $mRegex
Regular expression to match.
matches( $title, $action)
Check whether a user can perform the specified action on the specified Title.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Represents a title blacklist entry.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
static ns( $parser, $part1='')
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
static newFromString( $line, $source)
Create a new TitleBlacklistEntry from a line of text.
__construct( $regex, $params, $raw, $source)
Construct a new TitleBlacklistEntry.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
static getMainWANInstance()
Get the main WAN cache object.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
string $mSource
Source of this entry.