Jack Phoenix has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/184224

Change subject: Version 1.3: fixed to work with MW 1.24 & old cruft removed
......................................................................

Version 1.3: fixed to work with MW 1.24 & old cruft removed

Change-Id: I0458c535a819979dd63261a06b18e1c8d6809504
---
D FilterListUsers.i18n.php
M FilterListUsers.php
2 files changed, 16 insertions(+), 54 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FilterListUsers 
refs/changes/24/184224/1

diff --git a/FilterListUsers.i18n.php b/FilterListUsers.i18n.php
deleted file mode 100644
index 1bfa390..0000000
--- a/FilterListUsers.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * This is a backwards-compatibility shim, generated by:
- * 
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShim06952865fa09de4e' ) ) {
-       function wfJsonI18nShim06952865fa09de4e( $cache, $code, &$cachedData ) {
-               $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-               foreach ( $codeSequence as $csCode ) {
-                       $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
-                       if ( is_readable( $fileName ) ) {
-                               $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
-                               foreach ( array_keys( $data ) as $key ) {
-                                       if ( $key === '' || $key[0] === '@' ) {
-                                               unset( $data[$key] );
-                                       }
-                               }
-                               $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
-                       }
-
-                       $cachedData['deps'][] = new FileDependency( $fileName );
-               }
-               return true;
-       }
-
-       $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShim06952865fa09de4e';
-}
diff --git a/FilterListUsers.php b/FilterListUsers.php
index 95a6565..b69bc3e 100644
--- a/FilterListUsers.php
+++ b/FilterListUsers.php
@@ -4,20 +4,16 @@
  *
  * @file
  * @ingroup Extensions
- * @date February 22, 2010
+ * @date 4 January 2015
  * @author Jack Phoenix <[email protected]>
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-       die( "This is not a valid entry point.\n" );
-}
 
 // Extension credits that will show up on Special:Version
 $wgExtensionCredits['other'][] = array(
        'path' => __FILE__,
        'name' => 'FilterListUsers',
-       'version' => '1.1.0',
+       'version' => '1.3',
        'author' => 'Jack Phoenix',
        'descriptionmsg' => 'filterlistusers-desc',
        'url' => 'https://www.mediawiki.org/wiki/Extension:FilterListUsers',
@@ -27,10 +23,8 @@
 $wgAvailableRights[] = 'viewallusers';
 $wgGroupPermissions['sysop']['viewallusers'] = true;
 
-// i18n file
-$dir = dirname( __FILE__ ) . '/';
+// i18n files
 $wgMessagesDirs['FilterListUsers'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['FilterListUsers'] = $dir . 
'FilterListUsers.i18n.php';
 
 $wgHooks['SpecialListusersQueryInfo'][] = 'efFilterListUsersAlterQuery';
 /**
@@ -38,9 +32,9 @@
  * or when the user isn't privileged, only users with 5 (or more) edits will be
  * shown.
  *
- * @param $usersPager Object: instance of UsersPager
- * @param $query Array: SQL query parameters
- * @return Boolean: true
+ * @param UsersPager $usersPager
+ * @param array $query SQL query parameters
+ * @return bool
  */
 function efFilterListUsersAlterQuery( $usersPager, &$query ) {
        global $wgRequest, $wgUser;
@@ -58,8 +52,11 @@
        )
        {
                $dbr = wfGetDB( DB_SLAVE );
-               $revisionTable = $dbr->tableName( 'revision' );
-               $query['tables'] .= " JOIN (SELECT rev_user, COUNT(*) AS cnt 
FROM {$revisionTable} GROUP BY rev_user HAVING cnt > 5) AS tmp ON user_id = 
rev_user ";
+               $query['tables'][] = 'revision';
+               $query['fields'] = ( array_merge( $query['fields'], array( 
'rev_user', 'COUNT(*) AS cnt' ) ) );
+               $query['options']['GROUP BY'] = 'rev_user';
+               $query['options']['HAVING'] = 'cnt > 5';
+               $query['join_conds']['revision'] = array( 'JOIN', 'user_id = 
rev_user' );
        }
 
        return true;
@@ -69,9 +66,9 @@
 /**
  * Adds the "Show all users" checkbox for privileged users.
  *
- * @param $usersPager Object: instance of UsersPager
- * @param $out String: HTML output
- * @return Boolean: true
+ * @param UsersPager $usersPager
+ * @param string $out HTML output
+ * @return bool
  */
 function efFilterListUsersHeaderForm( $usersPager, &$out ) {
        global $wgRequest, $wgUser;
@@ -79,7 +76,7 @@
        // Show this checkbox only to privileged users
        if ( $wgUser->isAllowed( 'viewallusers' ) ) {
                $out .= Xml::checkLabel(
-                       wfMsg( 'listusers-showall' ),
+                       wfMessage( 'listusers-showall' )->plain(),
                        'showall',
                        'showall',
                        $wgRequest->getVal( 'showall' )
@@ -88,4 +85,4 @@
        }
 
        return true;
-}
+}
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/184224
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0458c535a819979dd63261a06b18e1c8d6809504
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FilterListUsers
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to