2008-06-27 06:18:51 +00:00
|
|
|
|
<?php
|
2010-08-19 21:12:09 +00:00
|
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
2008-06-27 06:18:51 +00:00
|
|
|
|
die();
|
2010-08-19 21:12:09 +00:00
|
|
|
|
}
|
2008-06-27 06:18:51 +00:00
|
|
|
|
|
2009-10-07 13:57:06 +00:00
|
|
|
|
/**
|
2008-06-27 06:18:51 +00:00
|
|
|
|
* Automatically applies heuristics to edits.
|
|
|
|
|
*
|
2009-10-07 13:57:06 +00:00
|
|
|
|
* @file
|
|
|
|
|
* @ingroup Extensions
|
2008-06-27 06:18:51 +00:00
|
|
|
|
* @author Andrew Garrett <andrew@epstone.net>
|
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
|
2009-01-30 00:54:20 +00:00
|
|
|
|
* Includes GFDL-licensed images retrieved from http://commons.wikimedia.org/wiki/File:Yes_check.svg
|
|
|
|
|
* and http://commons.wikimedia.org/wiki/File:Red_x.svg -- both have been downsampled and converted to PNG.
|
2009-10-07 13:57:06 +00:00
|
|
|
|
* @link http://www.mediawiki.org/wiki/Extension:AbuseFilter Documentation
|
2008-06-27 06:18:51 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2012-02-13 14:06:45 +00:00
|
|
|
|
$wgExtensionCredits['antispam'][] = array(
|
2009-10-07 13:57:06 +00:00
|
|
|
|
'path' => __FILE__,
|
|
|
|
|
'name' => 'Abuse Filter',
|
|
|
|
|
'author' => array( 'Andrew Garrett', 'River Tarnell', 'Victor Vasiliev' ),
|
2008-06-27 06:18:51 +00:00
|
|
|
|
'descriptionmsg' => 'abusefilter-desc',
|
2011-12-13 23:49:33 +00:00
|
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:AbuseFilter',
|
2008-06-27 06:18:51 +00:00
|
|
|
|
);
|
|
|
|
|
|
2012-09-02 11:07:02 +00:00
|
|
|
|
$dir = __DIR__;
|
2008-06-27 06:18:51 +00:00
|
|
|
|
$wgExtensionMessagesFiles['AbuseFilter'] = "$dir/AbuseFilter.i18n.php";
|
2011-12-18 10:27:44 +00:00
|
|
|
|
$wgExtensionMessagesFiles['AbuseFilterAliases'] = "$dir/AbuseFilter.alias.php";
|
2008-06-27 06:18:51 +00:00
|
|
|
|
|
2008-09-18 13:01:50 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilter'] = "$dir/AbuseFilter.class.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterParser'] = "$dir/AbuseFilter.parser.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterHooks'] = "$dir/AbuseFilter.hooks.php";
|
2011-05-10 23:05:25 +00:00
|
|
|
|
$wgAutoloadClasses['SpecialAbuseLog'] = "$dir/special/SpecialAbuseLog.php";
|
|
|
|
|
$wgAutoloadClasses['SpecialAbuseFilter'] = "$dir/special/SpecialAbuseFilter.php";
|
2012-04-14 10:10:35 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseLogHitFormatter'] = "$dir/AbuseLogHitFormatter.php";
|
2008-06-27 06:18:51 +00:00
|
|
|
|
|
2009-01-23 19:23:19 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewList'] = "$dir/Views/AbuseFilterViewList.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterView'] = "$dir/Views/AbuseFilterView.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewEdit'] = "$dir/Views/AbuseFilterViewEdit.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewTools'] = "$dir/Views/AbuseFilterViewTools.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewHistory'] = "$dir/Views/AbuseFilterViewHistory.php";
|
2009-01-28 00:10:35 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewRevert'] = "$dir/Views/AbuseFilterViewRevert.php";
|
2009-01-29 22:44:31 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewTestBatch'] = "$dir/Views/AbuseFilterViewTestBatch.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewExamine'] = "$dir/Views/AbuseFilterViewExamine.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterChangesList'] = "$dir/Views/AbuseFilterViewExamine.php";
|
2009-03-12 05:04:39 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewDiff'] = "$dir/Views/AbuseFilterViewDiff.php";
|
2009-04-23 04:23:56 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewImport'] = "$dir/Views/AbuseFilterViewImport.php";
|
2009-03-12 05:04:39 +00:00
|
|
|
|
|
2009-02-26 12:15:14 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterVariableHolder'] = "$dir/AbuseFilterVariableHolder.php";
|
|
|
|
|
$wgAutoloadClasses['AFComputedVariable'] = "$dir/AbuseFilterVariableHolder.php";
|
|
|
|
|
$wgAutoloadClasses['AFPData'] = "$dir/AbuseFilter.parser.php";
|
2009-01-23 19:23:19 +00:00
|
|
|
|
|
2008-06-27 06:18:51 +00:00
|
|
|
|
$wgSpecialPages['AbuseLog'] = 'SpecialAbuseLog';
|
|
|
|
|
$wgSpecialPages['AbuseFilter'] = 'SpecialAbuseFilter';
|
2009-01-28 10:38:58 +00:00
|
|
|
|
$wgSpecialPageGroups['AbuseLog'] = 'changes';
|
|
|
|
|
$wgSpecialPageGroups['AbuseFilter'] = 'wiki';
|
2008-06-27 06:18:51 +00:00
|
|
|
|
|
2011-05-10 23:05:25 +00:00
|
|
|
|
$wgAutoloadClasses['ApiQueryAbuseLog'] = "$dir/api/ApiQueryAbuseLog.php";
|
2009-03-28 23:40:27 +00:00
|
|
|
|
$wgAPIListModules['abuselog'] = 'ApiQueryAbuseLog';
|
2011-05-10 23:05:25 +00:00
|
|
|
|
$wgAutoloadClasses['ApiQueryAbuseFilters'] = "$dir/api/ApiQueryAbuseFilters.php";
|
2009-03-29 04:23:20 +00:00
|
|
|
|
$wgAPIListModules['abusefilters'] = 'ApiQueryAbuseFilters';
|
2011-09-29 23:30:42 +00:00
|
|
|
|
$wgAutoloadClasses['ApiAbuseFilterCheckSyntax'] = "$dir/api/ApiAbuseFilterCheckSyntax.php";
|
|
|
|
|
$wgAPIModules['abusefilterchecksyntax'] = 'ApiAbuseFilterCheckSyntax';
|
|
|
|
|
$wgAutoloadClasses['ApiAbuseFilterEvalExpression'] = "$dir/api/ApiAbuseFilterEvalExpression.php";
|
|
|
|
|
$wgAPIModules['abusefilterevalexpression'] = 'ApiAbuseFilterEvalExpression';
|
|
|
|
|
$wgAutoloadClasses['ApiAbuseFilterUnblockAutopromote'] = "$dir/api/ApiAbuseFilterUnblockAutopromote.php";
|
|
|
|
|
$wgAPIModules['abusefilterunblockautopromote'] = 'ApiAbuseFilterUnblockAutopromote';
|
|
|
|
|
$wgAutoloadClasses['ApiAbuseFilterCheckMatch'] = "$dir/api/ApiAbuseFilterCheckMatch.php";
|
|
|
|
|
$wgAPIModules['abusefiltercheckmatch'] = 'ApiAbuseFilterCheckMatch';
|
2009-03-28 23:40:27 +00:00
|
|
|
|
|
2013-01-04 15:37:56 +00:00
|
|
|
|
|
|
|
|
|
if ( defined( 'MW_SUPPORTS_CONTENTHANDLER' ) ) {
|
|
|
|
|
$wgHooks['EditFilterMergedContent'][] = 'AbuseFilterHooks::onEditFilterMergedContent';
|
|
|
|
|
} else {
|
|
|
|
|
$wgHooks['EditFilterMerged'][] = 'AbuseFilterHooks::onEditFilterMerged';
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 06:18:51 +00:00
|
|
|
|
$wgHooks['GetAutoPromoteGroups'][] = 'AbuseFilterHooks::onGetAutoPromoteGroups';
|
|
|
|
|
$wgHooks['AbortMove'][] = 'AbuseFilterHooks::onAbortMove';
|
|
|
|
|
$wgHooks['AbortNewAccount'][] = 'AbuseFilterHooks::onAbortNewAccount';
|
2012-05-10 08:08:48 +00:00
|
|
|
|
$wgHooks['AbortAutoAccount'][] = 'AbuseFilterHooks::onAbortAutoAccount';
|
2008-06-27 06:18:51 +00:00
|
|
|
|
$wgHooks['ArticleDelete'][] = 'AbuseFilterHooks::onArticleDelete';
|
2009-01-28 19:08:18 +00:00
|
|
|
|
$wgHooks['RecentChange_save'][] = 'AbuseFilterHooks::onRecentChangeSave';
|
|
|
|
|
$wgHooks['ListDefinedTags'][] = 'AbuseFilterHooks::onListDefinedTags';
|
2009-01-29 00:37:53 +00:00
|
|
|
|
$wgHooks['LoadExtensionSchemaUpdates'][] = 'AbuseFilterHooks::onLoadExtensionSchemaUpdates';
|
2009-04-24 01:53:12 +00:00
|
|
|
|
$wgHooks['ContributionsToolLinks'][] = 'AbuseFilterHooks::onContributionsToolLinks';
|
2009-06-03 15:10:44 +00:00
|
|
|
|
$wgHooks['UploadVerification'][] = 'AbuseFilterHooks::onUploadVerification';
|
2011-08-26 20:12:34 +00:00
|
|
|
|
$wgHooks['MakeGlobalVariablesScript'][] = 'AbuseFilterHooks::onMakeGlobalVariablesScript';
|
2012-02-10 23:41:05 +00:00
|
|
|
|
$wgHooks['ArticleSaveComplete'][] = 'AbuseFilterHooks::onArticleSaveComplete';
|
2008-06-27 06:18:51 +00:00
|
|
|
|
|
|
|
|
|
$wgAvailableRights[] = 'abusefilter-modify';
|
|
|
|
|
$wgAvailableRights[] = 'abusefilter-log-detail';
|
|
|
|
|
$wgAvailableRights[] = 'abusefilter-view';
|
|
|
|
|
$wgAvailableRights[] = 'abusefilter-log';
|
|
|
|
|
$wgAvailableRights[] = 'abusefilter-private';
|
2009-01-27 19:51:38 +00:00
|
|
|
|
$wgAvailableRights[] = 'abusefilter-modify-restricted';
|
2009-01-28 00:10:35 +00:00
|
|
|
|
$wgAvailableRights[] = 'abusefilter-revert';
|
2009-07-03 14:17:05 +00:00
|
|
|
|
$wgAvailableRights[] = 'abusefilter-view-private';
|
2012-06-17 08:20:10 +00:00
|
|
|
|
$wgAvailableRights[] = 'abusefilter-log-private';
|
2010-06-25 20:04:55 +00:00
|
|
|
|
$wgAvailableRights[] = 'abusefilter-hidden-log';
|
|
|
|
|
$wgAvailableRights[] = 'abusefilter-hide-log';
|
2012-09-12 15:31:24 +00:00
|
|
|
|
$wgAvailableRights[] = 'abusefilter-modify-global';
|
2008-06-27 06:18:51 +00:00
|
|
|
|
|
2009-03-11 07:12:42 +00:00
|
|
|
|
$wgLogTypes[] = 'abusefilter';
|
|
|
|
|
$wgLogNames['abusefilter'] = 'abusefilter-log-name';
|
|
|
|
|
$wgLogHeaders['abusefilter'] = 'abusefilter-log-header';
|
|
|
|
|
$wgLogActionsHandlers['abusefilter/modify'] = array( 'AbuseFilter', 'modifyActionText' );
|
2012-04-14 10:10:35 +00:00
|
|
|
|
$wgLogActionsHandlers['abusefilter/hit'] = 'AbuseLogHitFormatter';
|
2010-08-20 06:25:19 +00:00
|
|
|
|
$wgLogActions['suppress/hide-afl'] = 'abusefilter-logentry-suppress';
|
|
|
|
|
$wgLogActions['suppress/unhide-afl'] = 'abusefilter-logentry-unsuppress';
|
2009-03-11 07:12:42 +00:00
|
|
|
|
|
2011-08-26 20:12:34 +00:00
|
|
|
|
$commonModuleInfo = array(
|
2012-09-02 11:07:02 +00:00
|
|
|
|
'localBasePath' => __DIR__ . '/modules',
|
2011-08-26 20:12:34 +00:00
|
|
|
|
'remoteExtPath' => 'AbuseFilter/modules',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$wgResourceModules['ext.abuseFilter'] = array(
|
|
|
|
|
'styles' => 'ext.abuseFilter.css',
|
|
|
|
|
) + $commonModuleInfo;
|
|
|
|
|
|
|
|
|
|
$wgResourceModules['ext.abuseFilter.edit'] = array(
|
|
|
|
|
'scripts' => 'ext.abuseFilter.edit.js',
|
|
|
|
|
'messages' => array(
|
|
|
|
|
'abusefilter-edit-syntaxok',
|
2011-09-30 00:48:00 +00:00
|
|
|
|
'abusefilter-edit-syntaxerr',
|
|
|
|
|
'unknown-error',
|
2011-08-26 20:12:34 +00:00
|
|
|
|
),
|
|
|
|
|
'dependencies' => array(
|
2012-09-02 11:07:02 +00:00
|
|
|
|
'mediawiki.util',
|
2011-08-26 20:12:34 +00:00
|
|
|
|
'jquery.textSelection',
|
|
|
|
|
'jquery.spinner',
|
|
|
|
|
),
|
|
|
|
|
) + $commonModuleInfo;
|
|
|
|
|
|
|
|
|
|
$wgResourceModules['ext.abuseFilter.tools'] = array(
|
|
|
|
|
'scripts' => 'ext.abuseFilter.tools.js',
|
|
|
|
|
'messages' => array(
|
|
|
|
|
'abusefilter-reautoconfirm-notallowed',
|
|
|
|
|
'abusefilter-reautoconfirm-none',
|
|
|
|
|
'abusefilter-reautoconfirm-done',
|
|
|
|
|
),
|
|
|
|
|
'dependencies' => array(
|
2012-09-02 11:07:02 +00:00
|
|
|
|
'mediawiki.util',
|
2011-08-26 20:12:34 +00:00
|
|
|
|
'jquery.spinner'
|
|
|
|
|
),
|
|
|
|
|
) + $commonModuleInfo;
|
|
|
|
|
|
|
|
|
|
$wgResourceModules['ext.abuseFilter.examine'] = array(
|
|
|
|
|
'scripts' => 'ext.abuseFilter.examine.js',
|
|
|
|
|
'messages' => array(
|
|
|
|
|
'abusefilter-examine-match',
|
|
|
|
|
'abusefilter-examine-nomatch',
|
|
|
|
|
'abusefilter-examine-syntaxerror',
|
|
|
|
|
'abusefilter-examine-notfound',
|
|
|
|
|
),
|
2012-09-02 11:07:02 +00:00
|
|
|
|
'dependencies' => array(
|
|
|
|
|
'mediawiki.util',
|
|
|
|
|
),
|
2011-08-26 20:12:34 +00:00
|
|
|
|
) + $commonModuleInfo;
|
|
|
|
|
|
2011-12-28 00:48:15 +00:00
|
|
|
|
$wgAbuseFilterAvailableActions = array( 'flag', 'throttle', 'warn', 'disallow', 'blockautopromote', 'block', 'degroup', 'tag' );
|
2008-07-17 02:43:45 +00:00
|
|
|
|
|
2009-01-23 19:23:19 +00:00
|
|
|
|
$wgAbuseFilterConditionLimit = 1000;
|
2008-07-17 02:43:45 +00:00
|
|
|
|
|
2008-09-18 13:01:50 +00:00
|
|
|
|
// Disable filters if they match more than X edits, constituting more than Y% of the last Z edits, if they have been changed in the last S seconds
|
2012-10-23 13:14:34 +00:00
|
|
|
|
$wgAbuseFilterEmergencyDisableThreshold['default'] = 0.05;
|
|
|
|
|
$wgAbuseFilterEmergencyDisableCount['default'] = 2;
|
|
|
|
|
$wgAbuseFilterEmergencyDisableAge['default'] = 86400; // One day.
|
2008-07-31 16:28:24 +00:00
|
|
|
|
|
|
|
|
|
// Abuse filter parser class
|
2008-09-18 13:01:50 +00:00
|
|
|
|
$wgAbuseFilterParserClass = 'AbuseFilterParser';
|
2008-08-04 12:15:14 +00:00
|
|
|
|
|
2011-12-28 00:48:15 +00:00
|
|
|
|
$wgAbuseFilterRestrictedActions = array( 'block', 'degroup' );
|
2009-03-22 10:34:54 +00:00
|
|
|
|
|
2012-04-14 10:10:35 +00:00
|
|
|
|
// Abuse filter hit notification (available options: rc, udp, rcandudp)
|
|
|
|
|
$wgAbuseFilterNotifications = false;
|
2012-12-15 17:14:42 +00:00
|
|
|
|
// Enable notifications for private filters
|
|
|
|
|
$wgAbuseFilterNotificationsPrivate = false;
|
2009-03-30 06:12:12 +00:00
|
|
|
|
|
|
|
|
|
// Centralised filters
|
|
|
|
|
$wgAbuseFilterCentralDB = null;
|
|
|
|
|
$wgAbuseFilterIsCentral = false;
|
|
|
|
|
|
2012-08-03 21:55:35 +00:00
|
|
|
|
// Disallow Centralised filters from taking actions that locally
|
|
|
|
|
// block, remove from groups, or revoke permissions
|
|
|
|
|
$wgAbuseFilterDisallowGlobalLocalBlocks = false;
|
|
|
|
|
|
2009-06-03 15:52:53 +00:00
|
|
|
|
// Block duration
|
|
|
|
|
$wgAbuseFilterBlockDuration = 'indefinite';
|
2011-11-06 01:15:55 +00:00
|
|
|
|
|
2011-11-06 21:05:03 +00:00
|
|
|
|
// Callback functions for custom actions
|
2011-12-27 16:35:30 +00:00
|
|
|
|
$wgAbuseFilterCustomActionsHandlers = array();
|
2012-05-06 06:44:45 +00:00
|
|
|
|
|
|
|
|
|
// Valid "filter groups" – used for applying edit filters to certain types of actions
|
|
|
|
|
$wgAbuseFilterValidGroups = array('default');
|
2012-06-06 05:18:31 +00:00
|
|
|
|
|
|
|
|
|
// Default warning messages, per filter group
|
|
|
|
|
$wgAbuseFilterDefaultWarningMessage = array(
|
|
|
|
|
'default' => 'abusefilter-warning',
|
|
|
|
|
);
|