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
|
|
|
*/
|
|
|
|
|
2010-12-20 04:05:54 +00:00
|
|
|
$wgExtensionCredits[version_compare($wgVersion, '1.17alpha', '>=') ? 'antispam' : 'other'][] = 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
|
|
|
);
|
|
|
|
|
2009-10-07 13:57:06 +00:00
|
|
|
$dir = dirname( __FILE__ );
|
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";
|
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
|
|
|
|
2009-03-04 01:56:21 +00:00
|
|
|
$wgHooks['EditFilterMerged'][] = 'AbuseFilterHooks::onEditFilterMerged';
|
2008-06-27 06:18:51 +00:00
|
|
|
$wgHooks['GetAutoPromoteGroups'][] = 'AbuseFilterHooks::onGetAutoPromoteGroups';
|
|
|
|
$wgHooks['AbortMove'][] = 'AbuseFilterHooks::onAbortMove';
|
|
|
|
$wgHooks['AbortNewAccount'][] = 'AbuseFilterHooks::onAbortNewAccount';
|
|
|
|
$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';
|
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';
|
2010-06-25 20:04:55 +00:00
|
|
|
$wgAvailableRights[] = 'abusefilter-hidden-log';
|
|
|
|
$wgAvailableRights[] = 'abusefilter-hide-log';
|
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' );
|
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(
|
|
|
|
'localBasePath' => dirname( __FILE__ ) . '/modules',
|
|
|
|
'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(
|
|
|
|
'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(
|
|
|
|
'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',
|
|
|
|
),
|
|
|
|
) + $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
|
2008-09-22 14:40:57 +00:00
|
|
|
$wgAbuseFilterEmergencyDisableThreshold = 0.05;
|
2008-09-18 13:01:50 +00:00
|
|
|
$wgAbuseFilterEmergencyDisableCount = 2;
|
|
|
|
$wgAbuseFilterEmergencyDisableAge = 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
|
|
|
|
|
|
|
// UDP configuration
|
|
|
|
$wgAbuseFilterUDPPrefix = 'abusefilter:';
|
|
|
|
$wgAbuseFilterUDPAddress = null;
|
|
|
|
$wgAbuseFilterUDPPort = null;
|
2009-03-30 06:12:12 +00:00
|
|
|
|
|
|
|
// Centralised filters
|
|
|
|
$wgAbuseFilterCentralDB = null;
|
|
|
|
$wgAbuseFilterIsCentral = 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();
|