Index: trunk/extensions/CentralAuth/CentralAuth.php |
— | — | @@ -89,6 +89,7 @@ |
90 | 90 | $caBase = dirname( __FILE__ ); |
91 | 91 | $wgAutoloadClasses['SpecialCentralAuth'] = "$caBase/SpecialCentralAuth.php"; |
92 | 92 | $wgAutoloadClasses['SpecialMergeAccount'] = "$caBase/SpecialMergeAccount.php"; |
| 93 | +$wgAutoloadClasses['SpecialGlobalUsers'] = "$caBase/SpecialGlobalUsers.php"; |
93 | 94 | $wgAutoloadClasses['CentralAuthUser'] = "$caBase/CentralAuthUser.php"; |
94 | 95 | $wgAutoloadClasses['CentralAuthPlugin'] = "$caBase/CentralAuthPlugin.php"; |
95 | 96 | $wgAutoloadClasses['CentralAuthHooks'] = "$caBase/CentralAuthHooks.php"; |
— | — | @@ -126,6 +127,7 @@ |
127 | 128 | $wgSpecialPages['CentralAuth'] = 'SpecialCentralAuth'; |
128 | 129 | $wgSpecialPages['AutoLogin'] = 'SpecialAutoLogin'; |
129 | 130 | $wgSpecialPages['MergeAccount'] = 'SpecialMergeAccount'; |
| 131 | +$wgSpecialPages['GlobalUsers'] = 'SpecialGlobalUsers'; |
130 | 132 | |
131 | 133 | $wgLogTypes[] = 'globalauth'; |
132 | 134 | $wgLogNames['globalauth'] = 'centralauth-log-name'; |
Index: trunk/extensions/CentralAuth/SpecialGlobalUsers.php |
— | — | @@ -0,0 +1,71 @@ |
| 2 | +<?php
|
| 3 | +
|
| 4 | +class SpecialGlobalUsers extends SpecialPage {
|
| 5 | +
|
| 6 | + function __construct() {
|
| 7 | + wfLoadExtensionMessages('SpecialCentralAuth');
|
| 8 | + parent::__construct( 'GlobalUsers', 'centralauth-listusers' );
|
| 9 | + }
|
| 10 | +
|
| 11 | + function execute() {
|
| 12 | + global $wgOut;
|
| 13 | + $this->setHeaders();
|
| 14 | +
|
| 15 | + $pg = new GlobalUsersPager();
|
| 16 | + $wgOut->addHTML( $pg->getNavigationBar() );
|
| 17 | + $wgOut->addHTML( '<ul>' . $pg->getBody() . '</ul>' );
|
| 18 | + $wgOut->addHTML( $pg->getNavigationBar() );
|
| 19 | + }
|
| 20 | +}
|
| 21 | +
|
| 22 | +class GlobalUsersPager extends AlphabeticPager {
|
| 23 | + function __construct() {
|
| 24 | + parent::__construct();
|
| 25 | + $this->mDb = CentralAuthUser::getCentralSlaveDB();
|
| 26 | + }
|
| 27 | +
|
| 28 | + function getIndexField() {
|
| 29 | + return 'gu_name';
|
| 30 | + }
|
| 31 | +
|
| 32 | + function getQueryInfo() {
|
| 33 | + $localwiki = wfWikiID();
|
| 34 | + return array(
|
| 35 | + 'tables' => " globaluser LEFT JOIN localuser ON gu_name = lu_name AND lu_dbname = '{$localwiki}' ",
|
| 36 | + 'fields' => array( 'gu_name', 'gu_locked', 'lu_attached_method' ),
|
| 37 | + 'conds' => array( 'gu_hidden' => 0 ),
|
| 38 | + );
|
| 39 | + }
|
| 40 | +
|
| 41 | + function formatRow( $row ) {
|
| 42 | + $user = htmlspecialchars( $row->gu_name );
|
| 43 | + $info = array();
|
| 44 | + if( $row->gu_locked )
|
| 45 | + $info[] = wfMsgHtml( 'centralauth-listusers-locked' );
|
| 46 | + if( $row->lu_attached_method ) {
|
| 47 | + $userPage = Title::makeTitle( NS_USER, $row->gu_name );
|
| 48 | + $text = wfMsgHtml( 'centralauth-listusers-attached' );
|
| 49 | + $info[] = $this->getSkin()->makeLinkObj( $userPage, $text );
|
| 50 | + } else {
|
| 51 | + $info[] = wfMsgHtml( 'centralauth-listusers-nolocal' );
|
| 52 | + }
|
| 53 | + $info = implode( ', ', $info );
|
| 54 | + return '<li>' . wfSpecialList( $user, $info ) . '</li>';
|
| 55 | + }
|
| 56 | +
|
| 57 | + function getBody() {
|
| 58 | + if (!$this->mQueryDone) {
|
| 59 | + $this->doQuery();
|
| 60 | + }
|
| 61 | + $batch = new LinkBatch;
|
| 62 | +
|
| 63 | + $this->mResult->rewind();
|
| 64 | +
|
| 65 | + while ( $row = $this->mResult->fetchObject() ) {
|
| 66 | + $batch->addObj( Title::makeTitleSafe( NS_USER, $row->gu_name ) );
|
| 67 | + }
|
| 68 | + $batch->execute();
|
| 69 | + $this->mResult->rewind();
|
| 70 | + return parent::getBody();
|
| 71 | + }
|
| 72 | +}
|
Index: trunk/extensions/CentralAuth/CentralAuth.i18n.php |
— | — | @@ -160,6 +160,12 @@ |
161 | 161 | 'centralauth-admin-unlock-nonexistent' => 'Error: the global account "<nowiki>$1</nowiki>" does not exist.', |
162 | 162 | 'centralauth-admin-reason' => 'Reason: ', |
163 | 163 | |
| 164 | + // List of global list |
| 165 | + 'globalusers' => 'Global user list', |
| 166 | + 'centralauth-listusers-locked' => 'locked', |
| 167 | + 'centralauth-listusers-attached' => 'exists locally', |
| 168 | + 'centralauth-listusers-nolocal' => 'unattached or doesn\'t exist locally', |
| 169 | + |
164 | 170 | // Pretty timespan |
165 | 171 | 'centralauth-seconds-ago' => '$1 {{PLURAL:$1|second|seconds}} ago', |
166 | 172 | 'centralauth-minutes-ago' => '$1 {{PLURAL:$1|minute|minutes}} ago', |