jenkins-bot has submitted this change and it was merged. Change subject: Use user case for global group names, fix logging ......................................................................
Use user case for global group names, fix logging To get proper log entries I had to add an own log action handler for global group renames and change the target of the log entries. Note: This breakes b/c with older log entries, but this shouldn't be to much of an issue as this feature is rather new. Bug: 46631 Bug: 27551 Change-Id: I0003998612469b62583ab53c0917ad8116465a29 --- M CentralAuth.php M specials/SpecialGlobalGroupPermissions.php M specials/SpecialGlobalUsers.php 3 files changed, 41 insertions(+), 7 deletions(-) Approvals: CSteipp: Looks good to me, approved jenkins-bot: Verified diff --git a/CentralAuth.php b/CentralAuth.php index 4dd9669..bfd06d9 100644 --- a/CentralAuth.php +++ b/CentralAuth.php @@ -271,7 +271,7 @@ $wgLogActions['gblrights/groupperms'] = 'centralauth-rightslog-entry-groupperms'; $wgLogActions['gblrights/groupprms2'] = 'centralauth-rightslog-entry-groupperms2'; $wgLogActions['gblrights/groupprms3'] = 'centralauth-rightslog-entry-groupperms3'; -$wgLogActions['gblrights/grouprename'] = 'centralauth-rightslog-entry-grouprename'; +$wgLogActionsHandlers['gblrights/grouprename'] = 'efHandleGrouprenameLogEntry'; foreach ( array( 'newset', 'setrename', 'setnewtype', 'setchange', 'deleteset' ) as $type ) { $wgLogActionsHandlers["gblrights/{$type}"] = 'efHandleWikiSetLogEntry'; @@ -341,7 +341,7 @@ * @param $type * @param $action * @param $title - * @param $skin Skin + * @param $skin Skin|null If null, we want to use the wiki content language, since that will go to the IRC feed. * @param $params * @param $filterWikilinks bool * @return String @@ -382,3 +382,33 @@ return $msg->inContentLanguage()->text(); } } + +/** + * Format global group rename log entries + * + * @param $type + * @param $action + * @param $title + * @param $skin Skin|null If null, we want to use the wiki content language, since that will go to the IRC feed. + * @param $params + * @param $filterWikilinks bool + * + * @return String + */ +function efHandleGrouprenameLogEntry( $type, $action, $title, $skin, $params, $filterWikilinks = false ) { + // $params[0] is the new one, $params[1] the old one + if ( $skin ) { + $params[0] = Linker::link( Title::newFromText( $params[0] ), htmlspecialchars( $params[0] ) ); + $params[1] = Linker::link( Title::newFromText( $params[1] ), htmlspecialchars( $params[1] ) ); + } else { + $params[0] = htmlspecialchars( $params[0] ); + $params[1] = htmlspecialchars( $params[1] ); + } + + $msg = wfMessage( 'centralauth-rightslog-entry-grouprename' )->rawParams( $params[0], $params[1] ); + if ( $skin ) { + return $msg->text(); + } else { + return $msg->inContentLanguage()->text(); + } +} diff --git a/specials/SpecialGlobalGroupPermissions.php b/specials/SpecialGlobalGroupPermissions.php index da74e84..d5fb516 100644 --- a/specials/SpecialGlobalGroupPermissions.php +++ b/specials/SpecialGlobalGroupPermissions.php @@ -279,7 +279,7 @@ $this->getOutput()->addWikiMsg( 'centralauth-editgroup-invalid-name' ); return; } - $group = $group->getPrefixedDBkey(); + $group = $group->getUserCaseDBKey(); // (Potentially) New name of the group $newname = $this->getRequest()->getVal( 'wpGlobalGroupName', $group ); @@ -289,7 +289,7 @@ $this->getOutput()->addWikiMsg( 'centralauth-editgroup-invalid-name' ); return; } - $newname = $newname->getPrefixedDBkey(); + $newname = $newname->getUserCaseDBKey(); if ( $group != $newname ) { @@ -441,9 +441,13 @@ $log->addEntry( 'grouprename', - SpecialPage::getTitleFor( 'GlobalGroupPermissions', $newName ), + // This has to point to 'Special:GlobalUsers so that self::showLogFragment can find it + SpecialPage::getTitleFor( 'GlobalUsers', $newName ), $reason, - array( $oldName ) + array( + SpecialPage::getTitleFor( 'GlobalGroupPermissions', $newName ), + SpecialPage::getTitleFor( 'GlobalGroupPermissions', $oldName ) + ) ); } diff --git a/specials/SpecialGlobalUsers.php b/specials/SpecialGlobalUsers.php index 4e56632..638ffed 100644 --- a/specials/SpecialGlobalUsers.php +++ b/specials/SpecialGlobalUsers.php @@ -22,7 +22,7 @@ if ( $rqGroup ) { $groupTitle = Title::newFromText( $rqGroup ); if ( $groupTitle ) { - $pg->setGroup( $groupTitle->getPrefixedDBkey() ); + $pg->setGroup( $groupTitle->getUserCaseDBKey() ); } } -- To view, visit https://gerrit.wikimedia.org/r/56558 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0003998612469b62583ab53c0917ad8116465a29 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/CentralAuth Gerrit-Branch: master Gerrit-Owner: Hoo man <h...@online.de> Gerrit-Reviewer: Alex Monk <kren...@gmail.com> Gerrit-Reviewer: CSteipp <cste...@wikimedia.org> Gerrit-Reviewer: Hoo man <h...@online.de> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits