Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/169542
Change subject: Allow for searching the global rename log by previous username
......................................................................
Allow for searching the global rename log by previous username
Requires If8bdbadd88 in core.
TODO: Write a script to back-populate log_search.
Bug: 70850
Change-Id: I13c39874ff5f8690002658a34b9bcdf523ed0776
---
M CentralAuth.php
M i18n/en.json
M i18n/qqq.json
M includes/CentralAuthHooks.php
M includes/GlobalRename/GlobalRenameUserLogger.php
5 files changed, 44 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth
refs/changes/42/169542/1
diff --git a/CentralAuth.php b/CentralAuth.php
index 0aec469..46525f1 100644
--- a/CentralAuth.php
+++ b/CentralAuth.php
@@ -357,6 +357,8 @@
$wgHooks['APIGetParamDescription'][] =
'CentralAuthHooks::onAPIGetParamDescription';
$wgHooks['ApiCheckCanExecute'][] = 'CentralAuthHooks::onApiCheckCanExecute';
$wgHooks['TestCanonicalRedirect'][] =
'CentralAuthHooks::onTestCanonicalRedirect';
+$wgHooks['LogEventsListGetExtraInputs'][] =
'CentralAuthHooks::onLogEventsListGetExtraInputs';
+$wgHooks['SpecialLogAddLogSearchRelations'][] =
'CentralAuthHooks::onSpecialLogAddLogSearchRelations';
$wgHooks['UnitTestsList'][] = 'CentralAuthHooks::onUnitTestsList';
// For interaction with the Special:Renameuser extension
diff --git a/i18n/en.json b/i18n/en.json
index fe52581..8bfd871 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -472,5 +472,6 @@
"centralauth-abortlogin-renamed": "Your account was renamed to \"$1\".
Please use that username instead.",
"sulrenamewarning-title" : "{{GENDER:$1|Your}} account has been
renamed",
"sulrenamewarning-renamed" : "{{GENDER:$2|Your}} account '''$1''' has
been renamed to '''$2''' during automatic migration to the unified login system
of {{int:Centralauth-groupname}}.",
- "sulrenamewarning-usenew" : "Please use {{GENDER:$1|your}} new username
'''$1''' when logging in in the future."
+ "sulrenamewarning-usenew" : "Please use {{GENDER:$1|your}} new username
'''$1''' when logging in in the future.",
+ "centralauth-log-gblrename-oldname": "Previous username",
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 1b6d508..2e47054 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -479,5 +479,6 @@
"centralauth-abortlogin-renamed": "Error message shown when the user's
account was renamed, and they need to login with their new name\n\n* $1 is the
new username they should use.",
"sulrenamewarning-title": "[[Special:SulRenameWarning]] title\n\n* $1
is the user's new name for GENDER",
"sulrenamewarning-renamed": "Notice to user that their account has been
renamed.\n\n* $1 is the user's old name\n* $2 is the user's new name",
- "sulrenamewarning-usenew": "Instructions to user to login with new name
in the future\n\n* $1 is the user's new name"
+ "sulrenamewarning-usenew": "Instructions to user to login with new name
in the future\n\n* $1 is the user's new name",
+ "centralauth-log-gblrename-oldname": "Label for field on Special:Log
which allows filtering the global rename log by the previous username"
}
diff --git a/includes/CentralAuthHooks.php b/includes/CentralAuthHooks.php
index c07e89b..d9c03e5 100644
--- a/includes/CentralAuthHooks.php
+++ b/includes/CentralAuthHooks.php
@@ -1939,4 +1939,37 @@
}
return true;
}
+
+ /**
+ * @param $type
+ * @param WebRequest $request
+ * @param array $qc
+ * @return bool
+ */
+ public static function onSpecialLogAddLogSearchRelations( $type,
WebRequest $request, array &$qc ) {
+ if ( $type === 'gblrename' ) {
+ $oldname = User::getCanonicalName( $request->getVal(
'oldname' ) );
+ if ( $oldname ) {
+ $qc = array( 'ls_field' => 'oldname',
'ls_value' => $oldname );
+ }
+ }
+
+ return true;
+ }
+
+ public static function onLogEventsListGetExtraInputs( $type,
LogEventsList $list, &$input ) {
+ if ( $type === 'gblrename' ) {
+ $value = $list->getRequest()->getVal( 'oldname', '' );
+ if ( $value ) {
+ $value = User::getCanonicalName( $value ) ? :
'';
+ }
+ $input = Xml::inputLabel(
+ $list->msg( 'centralauth-log-gblrename-oldname'
)->text(),
+ 'oldname',
+ 'mw-log-gblrename-oldname',
+ 20,
+ $value
+ );
+ }
+ }
}
diff --git a/includes/GlobalRename/GlobalRenameUserLogger.php
b/includes/GlobalRename/GlobalRenameUserLogger.php
index 3b52b44..9d59e20 100644
--- a/includes/GlobalRename/GlobalRenameUserLogger.php
+++ b/includes/GlobalRename/GlobalRenameUserLogger.php
@@ -38,6 +38,11 @@
'4::olduser' => $oldName,
'5::newuser' => $newName,
) );
+
+ $logEntry->setRelations( array(
+ 'oldname' => $oldName,
+ ) );
+
$logid = $logEntry->insert();
$logEntry->publish( $logid );
}
--
To view, visit https://gerrit.wikimedia.org/r/169542
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I13c39874ff5f8690002658a34b9bcdf523ed0776
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits