Page MenuHomePhabricator

Extension user group messages on special:listusers
Closed, ResolvedPublic

Description

The messages for user group names from extension i18n files are not used on
Special:Listusers. MediaWiki messages like MediaWiki:group-checkuser,
MediaWiki:grouppage-checkuser or MediaWiki:group-steward-member from extensions
are not used in the user list if the messages are only defined in the i18n file.
If the corresponding pages in the MediaWiki namespace exist on the wiki, those
messages are used.


Version: unspecified
Severity: normal

Details

Reference
bz9554

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:36 PM
bzimport set Reference to bz9554.
bzimport added a subscriber: Unknown Object (MLST).

emil wrote:

On sites which restrict edits only to logged-in users MessageCache::loadAllMessages() is called on every pageview (via Title::userCan()). If additionally the site has many extensions (100+) this becomes pretty heavy (30-40ms overhead)

Consider applying the patch below which makes loadAllMessages() to be called only on Special:Listusers

Index: includes/User.php

  • includes/User.php (wersja 11849)

+++ includes/User.php (kopia robocza)
@@ -2541,8 +2541,6 @@

    • @static */ static function getGroupName( $group ) {
  • global $wgMessageCache;
  • $wgMessageCache->loadAllMessages(); $key = "group-$group"; $name = wfMsg( $key ); return $name == '' || wfEmptyMsg( $key, $name )

@@ -2556,8 +2554,6 @@

    • @static */ static function getGroupMember( $group ) {
  • global $wgMessageCache;
  • $wgMessageCache->loadAllMessages(); $key = "group-$group-member"; $name = wfMsg( $key ); return $name == '' || wfEmptyMsg( $key, $name )

@@ -2600,8 +2596,6 @@

    • @return mixed */ static function getGroupPage( $group ) {
  • global $wgMessageCache;
  • $wgMessageCache->loadAllMessages(); $page = wfMsgForContent( 'grouppage-' . $group ); if( !wfEmptyMsg( 'grouppage-' . $group, $page ) ) { $title = Title::newFromText( $page );

Index: includes/SpecialListusers.php

  • includes/SpecialListusers.php (wersja 11849)

+++ includes/SpecialListusers.php (kopia robocza)
@@ -196,8 +196,10 @@

    • $par string (optional) A group to list users from */ function wfSpecialListusers( $par = null ) {
  • global $wgRequest, $wgOut;

+ global $wgRequest, $wgOut, $wgMessageCache;

+ $wgMessageCache->loadAllMessages();
+

$up = new UsersPager($par);
 
# getBody() first to check, if empty