MediaWiki  1.33.0
Go to the documentation of this file.
1 <?php
13  public function filter( array $links, Title $title, $preventLog = false ) {
14  throw new LogicException( __CLASS__ . ' cannot be used to filter links.' );
15  }
22  protected function getBlacklistType() {
23  return 'email';
24  }
32  public function checkUser( User $user ) {
33  $blacklists = $this->getBlacklists();
34  $whitelists = $this->getWhitelists();
36  // The email to check
37  $email = $user->getEmail();
39  if ( !count( $blacklists ) ) {
40  // Nothing to check
41  return true;
42  }
44  // Check for whitelisted email addresses
45  if ( is_array( $whitelists ) ) {
46  wfDebugLog( 'SpamBlacklist', "Excluding whitelisted email addresses from " .
47  count( $whitelists ) . " regexes: " . implode( ', ', $whitelists ) . "\n" );
48  foreach ( $whitelists as $regex ) {
49  if ( preg_match( $regex, $email ) ) {
50  // Whitelisted email
51  return true;
52  }
53  }
54  }
56  # Do the match
57  wfDebugLog( 'SpamBlacklist', "Checking e-mail address against " . count( $blacklists ) .
58  " regexes: " . implode( ', ', $blacklists ) . "\n" );
59  foreach ( $blacklists as $regex ) {
60  if ( preg_match( $regex, $email ) ) {
61  return false;
62  }
63  }
65  return true;
66  }
67 }
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1476
filter(array $links, Title $title, $preventLog=false)
Definition: EmailBlacklist.php:13
Fetch local and (possibly cached) remote blacklists.
Definition: BaseBlacklist.php:220
Returns the code for the blacklist implementation.
Definition: EmailBlacklist.php:22
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:1043
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
Definition: injection.txt:35
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
checkUser(User $user)
Checks a User object for a blacklisted email address.
Definition: EmailBlacklist.php:32
Base class for different kinds of blacklists.
Definition: BaseBlacklist.php:6
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("", 2))
Email Blacklisting.
Definition: EmailBlacklist.php:6
Represents a title within MediaWiki.
Definition: Title.php:40
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
Definition: distributors.txt:9
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:48
Returns the (local) whitelist.
Definition: BaseBlacklist.php:253