Extension:AbuseFilter/hi

This page is a translated version of the page Extension:AbuseFilter and the translation is 25% complete.
Outdated translations are marked like this.
मीडियाविकि एक्सटेंशन मैनुअल
OOjs UI icon advanced-invert.svg
AbuseFilter
रिलीज़ की स्थिति: स्थिर
AbuseFilter-Management.png
कार्यान्वयन User activity , विशेष पृष्ठ , एपीआई
विवरण विकी गतिविधि पर विशिष्ट व्यवहार-आधारित प्रतिबंध लगाने की अनुमति देता है
लेखक
संगतता नीति Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.33+
PHP 5.4+ recommended
डेटाबेस बदलता है हाँ
तालिकाएँ abuse_filter
abuse_filter_action
abuse_filter_history
abuse_filter_log
लाइसेंस GNU General Public License 2.0 or later
डाउनलोड
  • $wgAbuseFilterConditionLimit
  • $wgAbuseFilterRangeBlockSize
  • $wgAbuseFilterAnonBlockDuration
  • $wgAbuseFilterLogIPMaxAge
  • $wgAbuseFilterCentralDB
  • $wgAbuseFilterDefaultWarningMessage
  • $wgAbuseFilterEmergencyDisableAge
  • $wgAbuseFilterProfileActionsCap
  • $wgAbuseFilterActionRestrictions
  • $wgAbuseFilterActions
  • $wgAbuseFilterLogIP
  • $wgAbuseFilterPrivateDetailsForceReason
  • $wgAbuseFilterEmergencyDisableCount
  • $wgAbuseFilterLogPrivateDetailsAccess
  • $wgAbuseFilterSlowFilterRuntimeLimit
  • $wgAbuseFilterEmergencyDisableThreshold
  • $wgAbuseFilterLocallyDisabledGlobalActions
  • $wgAbuseFilterBlockDuration
  • $wgAbuseFilterDefaultDisallowMessage
  • $wgAbuseFilterValidGroups
  • $wgAbuseFilterNotificationsPrivate
  • $wgAbuseFilterBlockAutopromoteDuration
  • $wgAbuseFilterIsCentral
  • $wgAbuseFilterNotifications
  • abusefilter-modify
  • abusefilter-log-detail
  • abusefilter-view
  • abusefilter-log
  • abusefilter-privatedetails
  • abusefilter-privatedetails-log
  • abusefilter-modify-restricted
  • abusefilter-revert
  • abusefilter-view-private
  • abusefilter-log-private
  • abusefilter-hidden-log
  • abusefilter-hide-log
  • abusefilter-modify-global
Translate the AbuseFilter extension if it is available at translatewiki.net

चेक उपयोग और संस्करण मैट्रिक्स.

मुद्दा ओपन कार्य · बग की रिपोर्ट करें
Coolest Tool Award 2020 square logo.svg

AbuseFilter

2020 Coolest Tool
Award Winner

in the category
Quality


एब्यूसफिल्टर विस्तार विशेषाधिकार प्राप्त उपयोगकर्ताओं को विशिष्ट कार्यों को सेट करने की अनुमति देता है जब उपयोगकर्ताओं द्वारा किए जाने वाले कार्य, जैसे संपादन, कुछ मानदंडों से मेल खाते हैं।

दाहरण के लिए, अनाम उपयोगकर्ताओं को बाहरी लिंक जोड़ने से रोकने के लिए या 2000 से अधिक वर्णों को निकालने वाले उपयोगकर्ता को अवरुद्ध करने के लिए एक फ़िल्टर बनाया जा सकता है।

स्थापित

  • Download and place the file(s) in a directory called AbuseFilter in your extensions/ folder.
  • Only when installing from git run Composer to install PHP dependencies, by issuing composer install --no-dev in the extension directory. (संभावित जटिलताओं के लिए task T173141 देखें।)
  • अपनी LocalSettings.php के नीचे निम्नलिखित कोड जोड़ें:
    wfLoadExtension( 'AbuseFilter' );
    
  • अद्यतन स्क्रिप्ट चलाएं जो स्वचालित रूप से आवश्यक डेटाबेस तालिकाओं का निर्माण करेगा जिसकी इस विस्तार को आवश्यकता है
  • Configure as required.
  •   पूर्ण – इस बात की पुष्टि करने के लिए अपने विकी पर Special:Version पर नेविगेट करें कि एक्सटेंशन सफलतापूर्वक स्थापित हो गया है।

MediaWiki 1.26 या इससे पहले वाले उपयोगकर्ताओं के लिए:

ऊपर दिए गए निर्देश wfLoadExtension() का उपयोग करके इस एक्सटेंशन को स्थापित करने के नए तरीके का वर्णन करते हैं। यदि आपको इस एक्सटेंशन को इन पिछले संस्करणों (MediaWiki 1.26 और इससे पहले) पर इंस्टॉल करना है, तो wfLoadExtension( 'AbuseFilter' ); के बजाय, आपको यह उपयोग करने की आवश्यकता है:

require_once "$IP/extensions/AbuseFilter/AbuseFilter.php";


When installing from Git, please note that this extension requires Composer .

So, after installation from Git change to the directory containing the extension e.g. "../extensions/AbuseFilter/" and run composer install --no-dev, or when updating: composer update --no-dev.

Alternatively as well as preferably add the line "extensions/AbuseFilter/composer.json" to the "composer.local.json" file in the root directory of your wiki like e.g.

{
	"extra": {
		"merge-plugin": {
			"include": [
				"extensions/AbuseFilter/composer.json"
			]
		}
	}
}

विन्यास

उपयोगकर्ता अधिकार

Once you installed the extension, you'll have to set up the user rights in "LocalSettings.php".

अधिकार विवरण
abusefilter-modify दुरुपयोग फ़िल्टर बनाएँ अथवा संशोधित करें
abusefilter-view दुरुपयोग फ़िल्टर देखें
abusefilter-log दुरुपयोग लॉग देखें
abusefilter-log-detail दुरुपयोग लॉग की प्रविष्टियाँ विस्तार में देखें
abusefilter-privatedetails दुरुपयोग लॉग में निजी डेटा देखें
abusefilter-modify-restricted दुरुपयोग फ़िल्टर को प्रतिबन्धित कार्यों सहित सम्पादित करें
abusefilter-modify-global वैश्विक दुरुपयोग फ़िल्टर बनाएँ अथवा संशोधित करें
abusefilter-revert किसी एक दिए गए दुरुपयोग फ़िल्टर द्वारा किये सभी परिवर्तनों को वापिस लें
abusefilter-view-private वो दुरुपयोग फ़िल्टर देखें जिन्हें निजी चिन्हित किया गया है
abusefilter-log-private निजी फ़िल्टरों की लॉग प्रविष्टियाँ देखें
abusefilter-hide-log दुरुपयोग लॉग में प्रविष्टियाँ छिपाएँ
abusefilter-hidden-log छुपी हुई दुरुपयोग लॉग प्रविष्टियाँ देखें
abusefilter-privatedetails-log View the AbuseFilter private details access log

उदाहरण के लिए, निम्न नमूना विन्यास सबस्पॉप्स को एब्यूसफिल्टर के साथ वे सब कुछ करने की अनुमति देगा, और हर कोई लॉग को देखने और सार्वजनिक फिल्टर सेटिंग्स देखने के लिए:

$wgGroupPermissions['sysop']['abusefilter-modify'] = true;
$wgGroupPermissions['*']['abusefilter-log-detail'] = true;
$wgGroupPermissions['*']['abusefilter-view'] = true;
$wgGroupPermissions['*']['abusefilter-log'] = true;
$wgGroupPermissions['sysop']['abusefilter-privatedetails'] = true;
$wgGroupPermissions['sysop']['abusefilter-modify-restricted'] = true;
$wgGroupPermissions['sysop']['abusefilter-revert'] = true;
निजी के रूप में चिह्नित फ़िल्टर केवल उपयोगकर्ताओं द्वारा या तो दुरुपयोगकर्ता-संशोधित या दुर्व्यवहार-देखने-निजी अनुमति के साथ देखे जा सकते हैं।

Parameters

परिवर्ती नाम === मूल मान === विवरण
$wgAbuseFilterActions
[
    'throttle' => true,
    'warn' => true,
    'disallow' => true,
    'blockautopromote' => true,
    'block' => true,
    'rangeblock' => false,
    'degroup' => false,
    'tag' => true
]
दुरुपयोग फिल्टर द्वारा संभव कार्रवाई की जा सकती है। When adding a new action, check if it is restricted in $wgAbuseFilterActionRestrictions and, if it is, don't forget to add the abusefilter-modify-restricted right to the appropriate user groups.
$wgAbuseFilterConditionLimit
1000
The maximum number of 'conditions' that can be used each time the filters are run against a change. (More complex filters require more 'conditions').
$wgAbuseFilterValidGroups
[
    'default'
]
"समूह" फिल्टर की सूची में विभाजित किया जा सकता है। डिफ़ॉल्ट रूप से केवल एक समूह होता है। Other extensions may add other groups.
$wgAbuseFilterEmergencyDisableThreshold
[
    'default' => 0.05
]
एक फ़िल्टर को अक्षम करें यदि यह 2 से अधिक संपादन से मेल खाता है, तो 5% से अधिक कार्यों का निर्माण होता है, जिन्हें फ़िल्टर के समूह के खिलाफ "देखे गए" अवधि (अधिकतम एक दिन) में जाँच लिया जाता है, जब तक कि पिछले 86400 सेकंड में फ़िल्टर को बदल न दिया गया हो (एक दिन) See emergency throttling.
$wgAbuseFilterEmergencyDisableCount
[
    'default' => 2
]
$wgAbuseFilterEmergencyDisableAge
[
    'default' => 86400
]
$wgAbuseFilterParserClass
'AbuseFilterParser'
एब्यूसफिल्टर के पार्सर वर्ग का नाम।
$wgAbuseFilterActionRestrictions
[
	"throttle" => false,
	"warn" => false,
	"disallow" => false,
	"blockautopromote" => true,
	"block" => true,
	"rangeblock" => true,
	"degroup" => true,
	"tag" => false
]
उपयोगकर्ताओं के पास "दुरुपयोगफिल्टर-संशोधित-प्रतिबंधित" उपयोगकर्ता के पास सही और साथ ही "एब्यूफिल्टर-संशोधित" होना चाहिए ताकि इन कार्यों को करने वाले फिल्टर बनाने या संशोधित किया जा सके।
$wgAbuseFilterNotifications
false
हिट सूचनाएं भेजने के लिए एक्सटेंशन को कॉन्फ़िगर करने की अनुमति देता है विशेष: हाल के परिवर्तन या यूडीपी। उपलब्ध विकल्प: rc, udp, rcandudp
$wgAbuseFilterNotificationsPrivate
false
निजी फ़िल्टर के लिए सूचनाएं सक्षम करें।
$wgAbuseFilterCentralDB
null
एक डेटाबेस का नाम जहां वैश्विक दुरुपयोग फिल्टर (केवल नवीनतम, विकास संस्करण में समर्थित) में संग्रहीत किया जाएगा। Requires CentralAuth installed otherwise global filters will break on a wikifarm.
$wgAbuseFilterIsCentral
false
विकी के लिए इस वैरिएबल को सही पर सेट करें जहां ग्लोबल एब्यूज फिल्टर (केवल नवीनतम, विकास संस्करण में समर्थित) में संग्रहीत हैं। Requires CentralAuth installed otherwise global filters will break on a wikifarm.
$wgAbuseFilterLocallyDisabledGlobalActions
[
	"throttle" => false,
	"warn" => false,
	"disallow" => false,
	"blockautopromote" => false,
	"block" => false,
	"rangeblock" => false,
	"degroup" => false,
	"tag" => false
]
स्थानीय रूप से ब्लॉक करने, समूहों से हटाने या अनुमतियों को रद्द करने की कार्रवाई करने से केंद्रीकृत फ़िल्टर हटाएं।
$wgAbuseFilterBlockDuration
'indefinite'
Duration of blocks made by AbuseFilter.
as of 1.31.0-wmf.25 block durations may be specified for every single filter and will override this variable. इस चर का उपयोग केवल तब किया जाता है जब किसी डिफ़ॉल्ट अवधि को हटाने के लिए ब्लॉक को सक्षम किया जाता है।
$wgAbuseFilterAnonBlockDuration
null
Duration of blocks made by AbuseFilter on users who are not logged in. The value of $wgAbuseFilterBlockDuration will be used if this is not set.
as of 1.31.0-wmf.25 block durations may be specified for every single filter and will override this variable. इस चर का उपयोग केवल तब किया जाता है जब किसी डिफ़ॉल्ट अवधि को हटाने के लिए ब्लॉक को सक्षम किया जाता है।
$wgAbuseFilterBlockAutopromoteDuration
5
Duration, in days, for which users' autopromotion is blocked by filters.
$wgAbuseFilterCustomActionsHandlers
[]
कस्टम क्रियाओं के लिए कॉलबैक फ़ंक्शन। (deprecated in 1.36) Use the AbuseFilterCustomActions hook instead.
$wgAbuseFilterDefaultWarningMessage
[
    'default' => 'abusefilter-warning'
]
डिफ़ॉल्ट चेतावनी संदेश, प्रति फ़िल्टर समूह
$wgAbuseFilterDefaultDisallowMessage
[
    'default' => 'abusefilter-disallowed'
]
Default disallow messages, per filter group
$wgAbuseFilterLogIPMaxAge
3 * 30 * 24 * 3600
Age used as cutoff when purging old IP log data. Defaults to 3 months. Used by maintenance script purgeOldLogIPData.php.
$wgAbuseFilterProfileActionsCap
10000
प्रोफाइलिंग आँकड़े रीसेट करने के लिए निर्धारित की जाने वाली क्रिया की संख्या।
$wgAbuseFilterLogPrivateDetailsAccess
false
Whether accessing private information from a filter log entry is logged.
$wgAbuseFilterPrivateDetailsForceReason
false
Whether users are forced to provide a reason for accessing private information from a filter log entry.
$wgAbuseFilterSlowFilterRuntimeLimit
500
Runtime in milliseconds before a filter is considered slow.
$wgAbuseFilterRangeBlockSize
[
    'IPv4' => '16',
    'IPv6' => '19',
]
Size of the range blocked by 'rangeblock' action.
$wgAbuseFilterLogIP
true
Whether to include IP in the abuse_filter_log

Emergency throttling

AbuseFilter comes with a feature that automatically throttles (disable) filters that have been edited recently and match a certain threshold of the latest actions.

This is done to prevent harmful edits on the filters to block every user that performs an action on the wiki or similar.

The condition to disable the filter depend on those variables:

  • $wgAbuseFilterEmergencyDisableThreshold - Percent of matches over the total amount of actions in the observed period.
  • $wgAbuseFilterEmergencyDisableCount - Count of matches of the filter in the observed period.
  • $wgAbuseFilterEmergencyDisableAge - Age of the filter to take it into account. If the last edit of the filter is older than this number of seconds, the filter won't be throttled, unless it's already throttled.
  • $wgAbuseFilterProfileActionsCap - Maximum number of recent actions to count against the threshold. Note that each action increments a counter, and once this counter reaches this configured value, this counter and the number of recent actions that matches all filters are reset to 0.

Throttled filters can be identified in the list of filters (Special:AbuseFilter) with the state सक्षम, throttled. Throttling happens silently, and there's no way to see when a filter got throttled.

When a filter gets throttled, it doesn't perform any dangerous action (the ones that can prevent the ongoing action), and only "safe" actions are allowed. Throttled filters don't get enabled automatically. To disable the throttling, you need to edit the filter. Note that you need to actually change something from the filter: changing something from the filter's notes is sufficient.

Note that editing the filter updates its age, and can cause it to be disabled if it reaches again the conditions to be throttled in a short period since the last edit, leading to a unusable filter if your wiki has more abuse edits than legitimate ones. Filters can also get randomly throttled if the action count reaches $wgAbuseFilterProfileActionsCap, causing all filter matches count to reset to 0, and then someone repeatedly makes a filter to hit.

फ़िल्टर बनाना और प्रबंधित करना

क बार एक्सटेंशन स्थापित हो जाने के बाद, फ़िल्टर बनाया जा सकता है / परीक्षण किया जा सकता है / बदल दिया जा सकता है / हटा दिया जा सकता है और लॉग को एब्यूज फ़िल्टर प्रबंधन पृष्ठ एब्यूसेफिल्टर से एक्सेस किया जा सकता है।

  • To import filters from Wikipedia: When you have installed the extension, go to w:Special:AbuseFilter, choose a filter (say w:Special:AbuseFilter/3), then click "Export this filter to another wiki", copy the text, go to "Special:AbuseFilter/import" on your wiki, paste the text.

API

AbuseFilter adds two API list modules, one for details of abuse filters ("abusefilters") and one for the abuse log, since it is separate from other MediaWiki logs ("abuselog"). It is not possible to create or modify abuse filters using the API.

list = abusefilters

फ़िल्टर के बारे में जानकारी सूचीबद्ध करें

Parameters
  • abfstartid - The filter id to start enumerating from
  • abfendid - The filter id to stop enumerating at
  • abfdir - The direction in which to enumerate (older, newer)
  • abfshow - Show only filters which meet these criteria (enabled|!enabled|deleted|!deleted|private|!private)
  • abflimit - The maximum number of filters to list
  • abfprop - Which properties to get (id|description|pattern|actions|hits|comments|lasteditor|lastedittime|status|private)

When filters are private, some of the properties specified with abfprop will be missing unless you have the appropriate user rights.

उदाहरण

गैर-निजी दुर्व्यवहार फ़िल्टर की सूची बनाएं

Result
<api>
  <query>
    <abusefilters>
      <filter id="1" hits="867" />
      <filter id="3" hits="66110" />
      <filter id="5" hits="464" />
      <filter id="6" hits="19" />
      <filter id="8" hits="7" />
      <filter id="9" hits="24869" />
      <filter id="11" hits="10033" />
      <filter id="14" hits="63" />
      <filter id="15" hits="15" />
      <filter id="16" hits="44" />
    </abusefilters>
  </query>
  <query-continue>
    <abusefilters abfstartid="18" />
  </query-continue>
</api>

list = abuselog

उदाहरणों को सूचीबद्ध करें जहां क्रियाओं ने एक दुरुपयोग फिल्टर को ट्रिगर किया।

Parameters
  • aflstart - The timestamp to start enumerating from
  • aflend - The timestamp to stop enumerating at
  • afldir - The direction in which to enumerate (older, newer)
  • afluser - Show only entries where the action was attempted by a given user or IP address.
  • afltitle - Show only entries where the action involved a given page.
  • aflfilter - Show only entries that triggered a given filter ID
  • afllimit - The maximum number of entries to list
  • aflprop - Which properties to get: (ids|filter|user|ip|title|action|details|result|timestamp|hidden|revid|wiki)
उदाहरण

List instances where the abuse filter was triggered in response to actions from the user "SineBot"

Result
<api>
  <query>
    <abuselog>
      <item id="900937" filter_id="211" user="SineBot" result="" />
      <item id="888404" filter_id="211" user="SineBot" result="" />
      <item id="862751" filter_id="211" user="SineBot" result="" />
      <item id="855649" filter_id="211" user="SineBot" result="" />
      <item id="842429" filter_id="211" user="SineBot" result="" />
      <item id="840958" filter_id="1" user="SineBot" result="" />
      <item id="824151" filter_id="211" user="SineBot" result="" />
      <item id="804892" filter_id="211" user="SineBot" result="" />
      <item id="205254" filter_id="58" user="SineBot" result="disallow" />
      <item id="205252" filter_id="58" user="SineBot" result="disallow" />
    </abuselog>
  </query>
  <query-continue>
    <abuselog aflstart="2009-04-19T02:07:55Z" />
  </query-continue>
</api>

Possible errors

  • Some users might experience that creating new filters or modifying old filters fail and the user just gets redirected to the original page. If the Wiki is using SSL certificates, this error could possibly be because of the $wgServer value, which might be using "http://" instead of "https://". An indication of this error will be, the browser giving https warning for Special:AbuseFilter pages. (Topic:T23dyyih0ofjada5)

Integration with other extensions

You can integrate AbuseFilter with other extension in various ways.

Adding variables for filtering

It is possible to add new variables, to be used in abuse filters. A list of examples is available . To do that, you should:

  • Add a handler for the AbuseFilter-builder hook. To add a variable, you should use $builder['vars']['variable_name'] = 'i18n-key';, where variable_name is the name of the variable, and i18n-key is the fragment of an i18n key. The full key will be abusefilter-edit-builder-vars-{$your_key}.
  • Add the i18n messages you chose at the previous point.
  • Choose a hook handler where the variable will be computed. Depending on your use case, you could:
    • Implement the AbuseFilter-generateTitleVars hook; this is specifically thought for page-related variables;
    • Implement the AbuseFilter-generateUserVars hook; this is specifically thought for user-related variables;
    • Implement the AbuseFilter-generateGenericVars hook; this is for variables not bound to a specific page or user;
    • Implement the AbuseFilterAlterVariables hook; this is a bit more flexible than the other hooks, but it has a downside: your variable will not be available when examining past RecentChanges entries. If you want to implement that feature (and it's recommended to do so), you should use one of the hooks listed above, and use its third parameter ($RCRow).
  • Inside the hook handler, there are two ways to add a variable:
    • The "direct" way is calling $vars->setVar( 'var_name', var_value );. This is ideal only when the value is easy and quick to compute: the value is computed even if no active filter will use it.
    • The "lazy" way is calling $vars->setLazyLoadVar( 'var_name', 'method_name', $params );. Here, 'method_name' is a (unique) identifier that will be used to compute the variable (it's recommended to prefix it with the name of your extension). To register the method, you should add a handler for the AbuseFilter-computeVariable hook; therein, you should check if the $method passed matches your 'method_name', and if so, compute the variable. Lastly, $params is an array of parameters that you'll need to compute the variable; these are passed to the computeVariable hook handler. For an example of this, you can check out CentralAuth's global_user_groups.

Adding custom actions

You can add custom action handlers, so that each filter may perform further actions. To do that, you choose a name for the action ('my-action' from now on), and then:

  • Create a class named e.g. MyAction, that should extend \MediaWiki\Extension\AbuseFilter\Consequence, which can also implement HookAborterConsequence or ConsequencesDisablerConsequence
  • Add a subscriber to the AbuseFilterCustomActions hook; the subscriber should provide a callback as documented in the hook documentation, that returns an instance of the class created above, for instance:
class MyAction extends \MediaWiki\Extension\AbuseFilter\Consequence {
    public function run() {
        throw new \Exception( 'Write me' );
    }
}
public function onAbuseFilterCustomActions( &$actions ) {
    $actions[] = function ( \MediaWiki\Extension\AbuseFilter\Consequence\Parameters $params, array $rawParams ) : MyConsequence {
        return new MyAction( $params, $rawParams );
    };
}

Then you should add the following i18n messages; you can replace 'my_action' with e.g. 'block' to see what the messages are for:

  • 'abusefilter-edit-action-${my_action}'
  • 'abusefilter-action-${my_action}'

Adding rule groups

You can also add extra rule groups, which can be used to group existing abuse filters. Note that, at the moment, each filter can only be in a single group (T116642). Currently, the only known consumer of this feature is Extension:StructuredDiscussions. To do that, you should:

  • Append the name of the group to $wgAbuseFilterValidGroups
  • Add some code to run the filters with your group. Note that AbuseFilter won't do that on its own. To do that, you should construct an AbuseFilterRunner object, passing in the name of your group.

इसे भी देखें