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',
|
2013-07-02 01:43:18 +00:00
|
|
|
|
'author' => array( 'Andrew Garrett', 'River Tarnell', 'Victor Vasiliev', 'Marius Hoch' ),
|
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',
|
2015-02-17 00:26:10 +00:00
|
|
|
|
'license-name' => 'GPL-2.0+',
|
2008-06-27 06:18:51 +00:00
|
|
|
|
);
|
|
|
|
|
|
2012-09-02 11:07:02 +00:00
|
|
|
|
$dir = __DIR__;
|
2014-03-25 13:09:11 +00:00
|
|
|
|
$wgMessagesDirs['AbuseFilter'] = "$dir/i18n";
|
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";
|
2015-08-25 19:57:23 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterTokenizer'] = "$dir/AbuseFilterTokenizer.php";
|
2008-09-18 13:01:50 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterHooks'] = "$dir/AbuseFilter.hooks.php";
|
2011-05-10 23:05:25 +00:00
|
|
|
|
$wgAutoloadClasses['SpecialAbuseLog'] = "$dir/special/SpecialAbuseLog.php";
|
2014-12-18 10:29:39 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseLogPager'] = "$dir/special/SpecialAbuseLog.php";
|
2011-05-10 23:05:25 +00:00
|
|
|
|
$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";
|
2014-12-18 10:29:39 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterPager'] = "$dir/Views/AbuseFilterViewList.php";
|
|
|
|
|
$wgAutoloadClasses['GlobalAbuseFilterPager'] = "$dir/Views/AbuseFilterViewList.php";
|
2009-01-23 19:23:19 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterView'] = "$dir/Views/AbuseFilterView.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewEdit'] = "$dir/Views/AbuseFilterViewEdit.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewTools'] = "$dir/Views/AbuseFilterViewTools.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewHistory'] = "$dir/Views/AbuseFilterViewHistory.php";
|
2014-12-18 10:29:39 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterHistoryPager'] = "$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";
|
2014-12-18 10:29:39 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterExaminePager'] = "$dir/Views/AbuseFilterViewExamine.php";
|
|
|
|
|
$wgAutoloadClasses['AbuseFilterChangesList'] = "$dir/Views/AbuseFilterView.php";
|
2009-03-12 05:04:39 +00:00
|
|
|
|
$wgAutoloadClasses['AbuseFilterViewDiff'] = "$dir/Views/AbuseFilterViewDiff.php";
|
2014-12-18 10:29:39 +00:00
|
|
|
|
$wgAutoloadClasses['TableDiffFormatterFullContext'] = "$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";
|
2014-12-18 10:29:39 +00:00
|
|
|
|
$wgAutoloadClasses['AFPException'] = "$dir/AbuseFilter.parser.php";
|
|
|
|
|
$wgAutoloadClasses['AFPParserState'] = "$dir/AbuseFilter.parser.php";
|
|
|
|
|
$wgAutoloadClasses['AFPToken'] = "$dir/AbuseFilter.parser.php";
|
|
|
|
|
$wgAutoloadClasses['AFPUserVisibleException'] = "$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';
|
|
|
|
|
|
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
|
|
|
|
|
2015-11-23 09:57:02 +00:00
|
|
|
|
$wgHooks['EditFilterMergedContent'][] = 'AbuseFilterHooks::onEditFilterMergedContent';
|
2008-06-27 06:18:51 +00:00
|
|
|
|
$wgHooks['GetAutoPromoteGroups'][] = 'AbuseFilterHooks::onGetAutoPromoteGroups';
|
|
|
|
|
$wgHooks['AbortMove'][] = 'AbuseFilterHooks::onAbortMove';
|
2014-10-27 17:55:33 +00:00
|
|
|
|
$wgHooks['MovePageCheckPermissions'][] = 'AbuseFilterHooks::onMovePageCheckPermissions';
|
2008-06-27 06:18:51 +00:00
|
|
|
|
$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';
|
2015-01-29 13:07:04 +00:00
|
|
|
|
$wgHooks['ChangeTagsListActive'][] = 'AbuseFilterHooks::onChangeTagsListActive';
|
2009-01-29 00:37:53 +00:00
|
|
|
|
$wgHooks['LoadExtensionSchemaUpdates'][] = 'AbuseFilterHooks::onLoadExtensionSchemaUpdates';
|
2009-04-24 01:53:12 +00:00
|
|
|
|
$wgHooks['ContributionsToolLinks'][] = 'AbuseFilterHooks::onContributionsToolLinks';
|
2013-02-28 01:25:59 +00:00
|
|
|
|
$wgHooks['UploadVerifyFile'][] = 'AbuseFilterHooks::onUploadVerifyFile';
|
2011-08-26 20:12:34 +00:00
|
|
|
|
$wgHooks['MakeGlobalVariablesScript'][] = 'AbuseFilterHooks::onMakeGlobalVariablesScript';
|
2012-02-10 23:41:05 +00:00
|
|
|
|
$wgHooks['ArticleSaveComplete'][] = 'AbuseFilterHooks::onArticleSaveComplete';
|
2013-07-04 00:25:25 +00:00
|
|
|
|
$wgHooks['APIEditBeforeSave'][] = 'AbuseFilterHooks::onAPIEditBeforeSave';
|
2014-07-10 03:57:02 +00:00
|
|
|
|
$wgHooks['UserMergeAccountFields'][] = 'AbuseFilterHooks::onUserMergeAccountFields';
|
2013-07-02 01:43:18 +00:00
|
|
|
|
$wgHooks['UnitTestsList'][] = 'AbuseFilterHooks::onUnitTestsList';
|
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(
|
2015-04-28 13:28:28 +00:00
|
|
|
|
'position' => 'top',
|
2011-08-26 20:12:34 +00:00
|
|
|
|
'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',
|
2014-07-30 14:46:53 +00:00
|
|
|
|
'abusefilter-http-error',
|
2011-09-30 00:48:00 +00:00
|
|
|
|
'unknown-error',
|
2011-08-26 20:12:34 +00:00
|
|
|
|
),
|
|
|
|
|
'dependencies' => array(
|
2012-09-02 11:07:02 +00:00
|
|
|
|
'mediawiki.util',
|
2012-10-26 00:23:17 +00:00
|
|
|
|
'mediawiki.api',
|
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',
|
2014-07-30 14:46:53 +00:00
|
|
|
|
'abusefilter-http-error',
|
2012-10-26 00:23:17 +00:00
|
|
|
|
'unknown-error',
|
2011-08-26 20:12:34 +00:00
|
|
|
|
),
|
|
|
|
|
'dependencies' => array(
|
2012-10-26 00:23:17 +00:00
|
|
|
|
'mediawiki.api',
|
|
|
|
|
'mediawiki.notify',
|
|
|
|
|
'user.tokens',
|
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-10-26 00:23:17 +00:00
|
|
|
|
'abusefilter-mustbeeditor',
|
2014-07-30 14:46:53 +00:00
|
|
|
|
'abusefilter-http-error',
|
2012-10-26 00:23:17 +00:00
|
|
|
|
'unknown-error',
|
2011-08-26 20:12:34 +00:00
|
|
|
|
),
|
2012-09-02 11:07:02 +00:00
|
|
|
|
'dependencies' => array(
|
2012-10-26 00:23:17 +00:00
|
|
|
|
'jquery.spinner',
|
|
|
|
|
'mediawiki.api'
|
2012-09-02 11:07:02 +00:00
|
|
|
|
),
|
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
|
|
|
|
|
2013-02-08 08:10:41 +00:00
|
|
|
|
$wgAbuseFilterRestrictedActions = array( 'block', 'degroup', 'blockautopromote', 'rangeblock' );
|
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;
|
|
|
|
|
|
2013-02-08 10:47:26 +00:00
|
|
|
|
// Block duration for logged in users
|
2009-06-03 15:52:53 +00:00
|
|
|
|
$wgAbuseFilterBlockDuration = 'indefinite';
|
2013-02-22 23:20:29 +00:00
|
|
|
|
// Block duration for anonymous users ($wgAbuseFilterBlockDuration will be used if null)
|
|
|
|
|
$wgAbuseFilterAnonBlockDuration = null;
|
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',
|
|
|
|
|
);
|
2013-08-27 17:00:27 +00:00
|
|
|
|
|
2015-02-17 00:26:10 +00:00
|
|
|
|
// Age used as cutoff when purging old IP log data.
|
|
|
|
|
// Used by maintenance script purgeOldLogIPData.php
|
2013-08-27 17:00:27 +00:00
|
|
|
|
$wgAbuseFilterLogIPMaxAge = 3 * 30 * 24 * 3600; // 3 months
|