Rozszerzenie:TitleBlacklist

From mediawiki.org
This page is a translated version of the page Extension:TitleBlacklist and the translation is 31% complete.
Outdated translations are marked like this.
To rozszerzenie jest dodawane do pakietu MediaWiki od wersji 1.21 i wyższych. W związku z tym nie musi być ponownie pobierane. Niemniej jednak wciąż musisz wykonać inne podane instrukcje.
Podręcznik rozszerzeń MediaWiki
TitleBlacklist
Status wydania: stabilne
Realizacja Uprawnienia użytkownika , API
Opis Blokuje tworzenie stron pasujących do czarnej listy wyrażeń regularnych.
Autor(zy) Victor Vasiliev (VasilievVVdyskusja)
Ostatnia wersja 1.5.0 (Continuous updates)
Polityka zgodności Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.35+
PHP 7.0+
Licencja GNU General Public License 2.0 or later
Pobieranie
  • $wgTitleBlacklistSources
  • $wgTitleBlacklistUsernameSources
  • $wgTitleBlacklistCaching
  • $wgTitleBlacklistBlockAutoAccountCreation
  • $wgTitleBlacklistLogHits

  • tboverride
  • tboverride-account
  • titleblacklistlog
Quarterly downloads 49 (Ranked 102nd)
Przetłumacz rozszerzenie TitleBlacklist jeżeli jest dostępne na translatewiki.net
Problemy Otwarte zadania · Zgłoś błąd
A proposal to rename this extension is discussed at zadanie T254650.

Rozszerzenie TitleBlacklist pozwala administratorom wiki blokować tworzenie, przenoszenie i przesyłanie stron, których tytuł strony pasuje do jednego lub kilku wyrażeń regularnych, jak również pozwala na blokowanie tworzenia kont z pasującymi do nich nazwami użytkownika.

Instalacja

  • Pobierz i umieść plik(i) w katalogu o nazwie TitleBlacklist w folderze extensions/.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
  • Dodaj poniższy kod na dole twojego pliku LocalSettings.php :
    wfLoadExtension( 'TitleBlacklist' );
    
  • Skonfiguruj źródła list zablokowanych (zobacz niżej)
  • Yes Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.
Domyślnie działa tylko na użytkowników, którzy nie są administratorami. Aby ustawić jako domyślnie dla wszystkich $wgGroupPermissions['sysop']['tboverride'] = false;.

Konfiguracja

$wgTitleBlacklistSources
Array of title blacklist sources.
Should be in array( name => source description ) format. Defaults to an empty array.
$wgTitleBlacklistUsernameSources
Sets the sources which may work as a username filter.
"*" is for all; false disables all.
If you want to limit it to particular sources, use array( source name 1, source name 2 ). This may be useful when you have shared account creation system in order to avoid blacklist fragmentation.
$wgTitleBlacklistLogHits
When true, logs on Special:Log/titleblacklist all attempts of local account creation that match the blacklists. Defaults to false. Note that even disabled, the log will still be visible for users groups with the titleblacklistlog right.
$wgTitleBlacklistCaching
?
$wgTitleBlacklistBlockAutoAccountCreation
Blokuje również konta utworzone automatycznie, które pasują do czarnych list. Defaults to true.

Multiple block list sources

The title block list can be gathered from multiple sources outside the local message. For configuring block list sources use code as described below:

wfLoadExtension( 'TitleBlacklist' );
$wgTitleBlacklistSources = [
    [
         'type' => 'localpage',
         'src'  => 'MediaWiki:Titleblacklist'
    ],
    [
         'type' => 'url',
         'src'  => 'https://meta.wikimedia.org/w/index.php?title=Title_blacklist&action=raw'
    ],
    [
         'type' => 'file',
         'src'  => '/home/wikipedia/blacklists/titles',
    ]
];

Zobacz task T113864, by uzyskać dalsze informacje.

Usage

Block list

Lista bloków tytułowych znajduje się na stronie MediaWiki:Titleblacklist.

Ta strona składa się z regularnych wyrażeń, każdego w osobnej linii. Each of them forbids the creation of pages whose titles match it. Na przykład:

Foo <autoconfirmed|noedit|errmsg=blacklisted-testpage> # This page name is not allowed
[Bb]ar # No one should create article about it
.*pandora.* # This word is not allowed in any part of a page name

Każdy wpis może zawierać dodatkowe atrybuty, zamknięty w <> i odseparowany za pomocą |.

  • autoconfirmed - also allows autoconfirmed users to perform such actions
  • casesensitive - do not ignore case when checking title for being put on the block list
  • noedit - also forbid editing the page (if it already exists)
  • moveonly - forbid moves but allow ordinary creation (rev:35163)
  • newaccountonly - forbid creation of matching usernames, but allow page creation (rev:38977)
  • reupload - allow reuploads of existing blocked files (rev:33656)
  • errmsg - the name of the message that should be displayed instead of standard

If the AntiSpoof extension is installed, you can also use the ‎<antispoof> attribute.

What is referred to here as regular expressions are not proper regular expressions, but rather subpatterns that are inserted into a hard-coded regular expression. i.e. the subpattern Foo from above would create a regular expression like /^Foo$/usi.

Podkreślniki ("_") w wyrażeniach regularnych zostaną zamienione przez to rozszerzenie na spacje, ponieważ nazwy stron są dopasowywane do jej poprawnej postaci („Nazwa strony” zamiast „Nazwa_strony”).

Bezpieczna lista

Istnieje również bezpieczna lista na stronie MediaWiki:Titlewhitelist. Najpierw ma zastosowanie lista zablokowanych. Wprowadzone przez użytkowników nazwy pasujące do czarnej listy są blokowane, chyba, że pasują do wpisu na białej liście. Nie musisz niczego konfigurować w LocalSettings.php, w celu wykorzystania białej listy. Wiele z opcjonalnych atrybutów wypisano powyżej. Działają one tak samo dla białej listy, jak np. casesensitive.

Dostosowywanie

Warning messages

Gdy próba utworzenia strony zostanie zablokowana z powodu umieszczenia tytułu na liście zablokowanych, użytkownikowi wyświetlany jest komunikat ostrzegawczy. Wyświetlana wiadomość może być zmieniona na tych stronach:

Niestandardowe nazwy komunikatów dla indywidualnych wpisów listy mogą być zdefiniowane przez użycie atrybutu errmsg.

Używanie TitleBlacklist do kontrolowania tworzenia kont użytkowników

Koncept

The username for new accounts will be regarded by this extension differently to the way it regards new articles. This extension will prepend "User:" (or its localized equivalent) to the string that a user enters at Username on the create account page. So when this extension is performing matches with your Regex's, as found on MediaWiki:Titleblacklist or MediaWiki:Titlewhitelist, it will match against "User:" + <userinput>.

For example, imagine you want to block "jill" as a new user. Imagine you had a block list regex "jill.* <newaccountonly>" and a user enters "jill" as the username on the create account page. This will pass as the comparison this extension will make will be between "jill.*" (the regex) and "User:jill" (the constructed input string). These don't match and so "jill" is allowed (and you probably didn't intend this). To effect the intended block use a regex like ".*jill.* <newaccountonly>" or "User:jill.* <newaccountonly>" on MediaWiki:Titleblacklist.

If you want to block all users except for all those that do match a regex then block all users in MediaWiki:Titleblacklist and write the permissible regex in the MediaWiki:Titlewhitelist.

Jak

If you would like to force all usernames, during account creation, to consist of exactly two names, space separated, with each name capitalized then do the following:

1. Zainstaluj TitleBlacklist.

2. Dodaj poniższy kod do swojego LocalSettings.php .

wfLoadExtension( 'TitleBlacklist' );
$wgGroupPermissions['sysop']['tboverride'] = false; 
$wgTitleBlacklistSources = [
  [
    'type' => 'localpage',
    'src'  => 'MediaWiki:Titleblacklist'
  ]
];

3. In https://www.example.com/mywiki/MediaWiki:Titleblacklist add

# Block all user accounts, and only permit those that match the MediaWiki:Titlewhitelistregex 
.* <newaccountonly>

4. In https://www.example.com/mywiki/MediaWiki:Titlewhitelist add

# Only allow two names, separated by a space, with each name capitalized, e.g. "Fred Mew" OK, "Fred mew" fails, "Fredmew" fails.
# Depends on .* <newaccountonly> in block list
User:[A-Z][a-z]+\s[A-Z][a-z]+ <casesensitive>

5. In https://www.example.com/mywiki/MediaWiki:Titleblacklist-forbidden-new-account edit

The user name "$2" has been blocked from creation. It matches the following block list entry: <code>$1</code>.

Please use a real name for the user name. User names need to be comprised of two names separated by a space. Each name must be capitalized.

E.g.:
* "Mary Smith". OK.
* "MarySmith". Invalid.
* "Mary smith". Invalid.
* "marysmith". Invalid.

Zasady blokowania tworzenia stron użytkownika i artykułów są kontrolowane przez MediaWiki:Titleblacklist i MediaWiki:Titlewhitelist. Wiadomość może zostać zmieniona na stronie MediaWiki:Titleblacklist-forbidden-new-account.

Testing for matches

The API module action=titleblacklist can be used to test a title and action (e.g. edit, create, new-account) against the block list. Users with the 'tboverride' right should be sure to supply the tbnooverride parameter.

For example, if the block list contained the filter:

.*(.)\1{10}.* <newaccountonly|errmsg=titleblacklist-forbidden-new-account-invalid> # Disallows eleven or more of the same character repeated in usernames

you could use an API request like

Wynik
{
    "titleblacklist": {
        "result": "blacklisted",
        "reason": "<table  class=\"plainlinks fmbox\nfmbox-system \" style=\"\" role=\"presentation\" dir=\"ltr\">\n<tr>\n<td class=\"mbox-image\">\n  [[File:Imbox notice.png|40x40px|link=|alt=]]</td>\n<td class=\"mbox-text\" style=\"\"> The user name \"AAAAAAAAAAA\" [[Mediawiki talk:Titleblacklist|has been put on the block list]] from creation. </td>\n\n</tr>\n</table>",
        "message": "titleblacklist-forbidden-new-account-invalid",
        "line": ".*(.)\1{10}.* &lt;newaccountonly|errmsg=titleblacklist-forbidden-new-account-invalid&gt; # Disallows eleven or more of the same character repeated in usernames"
    }
}

If Scribunto is installed, this extension allows for testing if particular titles and actions will match an entry in the block list using the mw.ext.TitleBlacklist.test function. If a match is found, the details for the matched entry are returned.

Na przykład, jeśli lista zablokowanych zawierała filtr:

.*(.)\1{10}.* <newaccountonly|errmsg=titleblacklist-forbidden-new-account-invalid> # Disallows eleven or more of the same character repeated in usernames

uruchamiający funkcję:

mw.ext.TitleBlacklist.test("new-account", "AAAAAAAAAAA")

would return the following table containing details about the matched entry:

{
	custommessage = "titleblacklist-forbidden-new-account-invalid",
	message = "titleblacklist-forbidden-new-account-invalid",
	params = {
		errmsg = "titleblacklist-forbidden-new-account-invalid",
		newaccountonly = true
	},
	raw = " .*(.)\1{10}.* <newaccountonly|errmsg=titleblacklist-forbidden-new-account-invalid> # Disallows eleven or more of the same character repeated in usernames",
	regex = ".*(.)\1{10}.*",
	version = 3
}

Clearing the cache

The contents of the block lists are cached. Changes in block lists configured at a URL or a file on the server are not applied immediately. To force clearing the cache, edit and save the page MediaWiki:Titleblacklist (even if you don't change anything). It doesn't matter if it's configured as a block list or not. See includes/Hooks.php.

Strony o wyrażeniach regularnych

Zobacz też