Go to the documentation of this file.
11 global $wgDisableAuthManager, $wgAuthManagerAutoConfig;
17 Hooks::register(
'AbortNewAccount',
'SpamBlacklistHooks::abortNewAccount' );
38 $pout = $editInfo->output;
39 $links = array_keys( $pout->getExternalLinks() );
43 if ( preg_match(
'/\S(\.[^\s\d]{2,}|[\/@]\S)/', $summary ) ) {
51 $status->fatal(
'spamprotectiontext' );
54 $status->fatal(
'spamprotectionmatch', $match );
58 'spamblacklist' => implode(
'|',
$matches ),
69 $links = array_keys(
$output->getExternalLinks() );
71 $spamObj->warmCachesForFilter(
$page->getTitle(), $links );
84 if ( $blacklist->checkUser(
$user ) ) {
88 $hookErr =
array(
'spam-blacklisted-email',
'spam-blacklisted-email-text',
null );
103 if ( $blacklist->checkUser(
$user ) ) {
107 $abortError =
wfMessage(
'spam-blacklisted-email-signup' )->escaped();
123 $thisPageName = $editPage->mTitle->getPrefixedDBkey();
126 wfDebugLog(
'SpamBlacklist',
"Spam blacklist validator: [[$thisPageName]] not a local blacklist\n" );
131 if (
$type ===
false ) {
135 $lines = explode(
"\n", $text );
139 wfDebugLog(
'SpamBlacklist',
"Spam blacklist validator: [[$thisPageName]] given invalid input lines: " .
140 implode(
', ', $badLines ) .
"\n" );
142 $badList =
"*<code>" .
143 implode(
"</code>\n*<code>",
144 array_map(
'wfEscapeWikiText', $badLines ) ) .
147 "<div class='errorbox'>" .
148 wfMessage(
'spam-invalid-lines' )->numParams( $badLines )->text() .
"<br />" .
151 "<br clear='all' />\n";
153 wfDebugLog(
'SpamBlacklist',
"Spam blacklist validator: [[$thisPageName]] ok or empty blacklist\n" );
192 ->doLogging(
$user, $wikiPage->getTitle(), $revision->getId() );
202 $blacklist->clearCache();
219 $title = $upload->getTitle();
223 $parserOptions =
$content->getContentHandler()->makeParserOptions(
'canonical' );
225 $links = array_keys(
$output->getExternalLinks() );
229 if ( preg_match(
'/\S(\.[^\s\d]{2,}|[\/@]\S)/', $comment ) ) {
246 'key' =>
'spamprotectionmatch',
265 if ( !$spam->isLoggingEnabled() ) {
272 $spam->logUrlChanges( $spam->getCurrentLinks(
$article->getTitle() ), [], [] );
static getBlacklistTypes()
Return the array of blacklist types currently defined.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
static onArticleDeleteComplete(&$page, User &$user, $reason, $id, Content $content=null, LogEntry $logEntry)
static getInstance( $type)
Returns an instance of the given blacklist.
static validate( $editPage, $text, $section, &$hookError)
Hook function for EditFilter Confirm that a local blacklist page being saved is valid,...
static pageSaveContent(Page $wikiPage, User $user, Content $content, $summary, $isMinor, $isWatch, $section, $flags, $revision, Status $status, $baseRevId)
Hook function for PageContentSaveComplete Clear local spam blacklist caches on page save.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
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
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Class representing a MediaWiki article and history.
static isLocalSource(Title $title)
Check if the given local page title is a spam regex source.
static getTypeFromTitle(Title $title)
Returns the type of blacklist from the given title.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
static getBadLines( $lines, BaseBlacklist $blacklist)
Returns an array of invalid lines.
getTitle()
Get the Title object.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
static filterMergedContent(IContextSource $context, Content $content, Status $status, $summary, User $user, $minoredit)
Hook function for EditFilterMergedContent.
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
static onArticleDelete(WikiPage &$article, User &$user, &$reason, &$error)
Extension of Message implementing IApiMessage.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
namespace and then decline to actually register it file or subcat img or subcat $title
Interface for log entries.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
getWikiPage()
Get the WikiPage object.
static onParserOutputStashForEdit(WikiPage $page, Content $content, ParserOutput $output)
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object & $output
when a variable name is used in a it is silently declared as a new masking the global
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
static register( $name, $callback)
Attach an event handler to a given hook.
static abortNewAccount( $user, &$abortError)
Processes new accounts for valid email addresses.
static onUploadVerifyUpload(UploadBase $upload, User $user, array $props, $comment, $pageText, &$error)
Interface for objects which can provide a MediaWiki context on request.
Base interface for content objects.
Hooks for the spam blacklist extension.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
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
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
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 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 "<
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
static userCanSendEmail(&$user, &$hookErr)
Verify that the user can send emails.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
the array() calling protocol came about after MediaWiki 1.4rc1.
static registerExtension()