Cenarium has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/333559 )
Change subject: Don't display anons in title blacklist log, add to CU data,
reenable it
......................................................................
Don't display anons in title blacklist log, add to CU data, reenable it
This alters the title blacklist log formatter so that unregistered users
are not displayed publicly. This also makes sure that the checkuser extension is
aware of the log, even though the log isn't published (which cannot happen
since the log is restricted). In addition, this actually enables logging, which
got disabled in Ie9639a15d04b387be0e72754301eb6d91cd8adc2.
Change-Id: If9016372cbe06c498b9bc07a6cf8497371613d7c
---
M TitleBlacklist.hooks.php
A TitleBlacklistHitLogFormatter.php
M TitleBlacklistPreAuthenticationProvider.php
M extension.json
M i18n/en.json
M i18n/qqq.json
6 files changed, 35 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TitleBlacklist
refs/changes/59/333559/1
diff --git a/TitleBlacklist.hooks.php b/TitleBlacklist.hooks.php
index 31fc457..e95f633 100644
--- a/TitleBlacklist.hooks.php
+++ b/TitleBlacklist.hooks.php
@@ -351,7 +351,12 @@
'4::entry' => $entry,
) );
$logid = $logEntry->insert();
- $logEntry->publish( $logid );
+ if ( class_exists( CheckUserHooks ) ) {
+ // get recent change, note that it will not be
published
+ $rc = $logEntry->getRecentChange( $logid );
+ // allow CUs to see this action
+ CheckUserHooks::updateCheckUserData( $rc );
+ }
}
}
diff --git a/TitleBlacklistHitLogFormatter.php
b/TitleBlacklistHitLogFormatter.php
new file mode 100644
index 0000000..2e5712b
--- /dev/null
+++ b/TitleBlacklistHitLogFormatter.php
@@ -0,0 +1,23 @@
+<?php
+
+class TitleBlacklistHitLogFormatter extends LogFormatter {
+ protected $isAnonAccountCreation = true;
+ protected function getMessageKey() {
+ if ( $this->entry->getSubtype() === 'hit-username' ) {
+ if ( $this->entry->getPerformer()->isAnon() ) {
+ $this->isAnonAccountCreation = true;
+ // message with no mention of IP
+ return
'logentry-titleblacklist-hit-username-anon';
+ }
+ }
+ return parent::getMessageKey();
+ }
+ protected function getMessageParameters() {
+ $params = parent::getMessageParameters();
+ if ( $this->isAnonAccountCreation ) {
+ // remove IP from message params
+ unset( $params[0], $params[1] );
+ }
+ return $params;
+ }
+}
diff --git a/TitleBlacklistPreAuthenticationProvider.php
b/TitleBlacklistPreAuthenticationProvider.php
index b2371ca..f4e399d 100644
--- a/TitleBlacklistPreAuthenticationProvider.php
+++ b/TitleBlacklistPreAuthenticationProvider.php
@@ -43,7 +43,7 @@
if ( !$autocreate && empty( $options['creating'] ) ||
$this->blockAutoAccountCreation ) {
$sv->merge( TitleBlacklistHooks::testUserName(
- $user->getName(), $creator, true,
(bool)$autocreate
+ $user->getName(), $creator, true, true
) );
}
return $sv;
diff --git a/extension.json b/extension.json
index c770dba..bd40c0c 100644
--- a/extension.json
+++ b/extension.json
@@ -30,7 +30,7 @@
"titleblacklist": "titleblacklistlog"
},
"LogActionsHandlers": {
- "titleblacklist/*": "LogFormatter"
+ "titleblacklist/hit-username": "TitleBlacklistHitLogFormatter"
},
"GrantPermissions": {
"viewrestrictedlogs": {
@@ -49,6 +49,7 @@
"TitleBlacklist": "TitleBlacklist.list.php",
"TitleBlacklistEntry": "TitleBlacklist.list.php",
"TitleBlacklistHooks": "TitleBlacklist.hooks.php",
+ "TitleBlacklistHitLogFormatter":
"TitleBlacklistHitLogFormatter.php",
"TitleBlacklistAuthenticationRequest":
"TitleBlacklistAuthenticationRequest.php",
"TitleBlacklistPreAuthenticationProvider":
"TitleBlacklistPreAuthenticationProvider.php",
"Scribunto_LuaTitleBlacklistLibrary":
"TitleBlacklist.library.php",
diff --git a/i18n/en.json b/i18n/en.json
index 225adc3..f53888f 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -6,6 +6,7 @@
"log-name-titleblacklist": "Title blacklist log",
"log-description-titleblacklist": "These events track title blacklist
hits.",
"logentry-titleblacklist-hit-username": "$1 {{GENDER:$2|caused}} a
title blacklist hit when trying to create account $3 matching $4.",
+ "logentry-titleblacklist-hit-username-anon": "An anonymous user caused
a title blacklist hit when trying to create account $1 matching $2.",
"titleblacklist-desc": "Allows administrators to forbid creation of
pages and user accounts per a [[MediaWiki:Titleblacklist|blacklist]] and
[[MediaWiki:Titlewhitelist|whitelist]]",
"titleblacklist": "# This is a title blacklist. Titles and users that
match a regular expression here cannot be created.\n# Use \"#\" for
comments.\n# This is case insensitive by default",
"titlewhitelist": "# This is a title whitelist. Use \"#\" for
comments.\n# This is case insensitive by default",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c4111e2..9e774df 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -14,7 +14,8 @@
"action-titleblacklistlog": "{{doc-action|titleblacklistlog}}",
"log-name-titleblacklist": "Name of log that appears on
[[Special:Log]].",
"log-description-titleblacklist": "Description of title blacklist log",
- "logentry-titleblacklist-hit-username": "Log entry that is created when
someone tries to create an account with a name that is blacklisted on the
title blacklist.\n\n{{logentry}}\nAdditional parameters:\n* $4 - the blacklist
entry",
+ "logentry-titleblacklist-hit-username": "Log entry that is created when
a logged-in user tries to create an account with a name that is blacklisted on
the title blacklist.\n\n{{logentry}}\nAdditional parameters:\n* $4 - the
blacklist entry",
+ "logentry-titleblacklist-hit-username-anon": "Log entry that is created
when a logged-out user tries to create an account with a name that is
blacklisted on the title blacklist.\n\n{{logentry}}\nParameters:\n* $1 - the
username\n* $2 - the blacklist entry",
"titleblacklist-desc": "{{desc|name=Title
Blacklist|url=https://www.mediawiki.org/wiki/Extension:TitleBlacklist}}",
"titleblacklist": "The [[mw:Extension:TitleBlacklist|extension Title
Blacklist]] gives the ability to block certain unallowed words appearing in the
title through regular expressions.\nThis will be the first explanatory
paragraph of the blacklist. (Characters after the #-signs are ignored.) \nTo
see an example list in context, see:
http://www.mediawiki.org/wiki/MediaWiki:Titleblacklist",
"titlewhitelist": "The whitelist is a feature of the
[[mw:Extension:TitleBlacklist|extension Title Blacklist]], which gives the
ability to block certain words (or explicitly allow them) appearing in the
title through regular expressions.\nThis will be the explanatory paragraph of
the blacklist. (Characters after the #-signs are ignored.) \nTo see an example
list in context, see: http://www.mediawiki.org/wiki/MediaWiki:Titlewhitelist",
--
To view, visit https://gerrit.wikimedia.org/r/333559
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9016372cbe06c498b9bc07a6cf8497371613d7c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TitleBlacklist
Gerrit-Branch: master
Gerrit-Owner: Cenarium <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits