* (bug 4167) Fix regression caused by patch for bug 153
[lhc/web/wiklou.git] / includes / SpecialListusers.php
index 8b26bed..49a3c11 100644 (file)
@@ -40,14 +40,38 @@ require_once('QueryPage.php');
 class ListUsersPage extends QueryPage {
        var $requestedGroup = '';
        var $requestedUser = '';
-       var $previousResult = null;
-       var $concatGroups = '';
        
        function getName() {
                return 'Listusers';
        }
        function isSyndicated() { return false; }
 
+       /**
+        * Not expensive, this class won't work properly with the caching system anyway
+        */
+       function isExpensive() {
+               return false;
+       }
+
+       /**
+        * Fetch user page links and cache their existence
+        */
+       function preprocessResults( &$db, &$res ) {
+               global $wgLinkCache;
+               
+               $batch = new LinkBatch;
+               while ( $row = $db->fetchObject( $res ) ) {
+                       $batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) );
+               }
+               $batch->execute( $wgLinkCache );
+
+               // Back to start for display
+               if( $db->numRows( $res ) > 0 ) {
+                       // If there are no rows we get an error seeking.
+                       $db->dataSeek( $res, 0 );
+               }
+       }
+
        /**
         * Show a drop down list to select a group as well as a user name
         * search box.
@@ -86,7 +110,7 @@ class ListUsersPage extends QueryPage {
                $out .= wfMsgHtml( 'specialloguserlabel' ) . '<input type="text" name="username" /> ';
 
                // OK button, end of form.
-               $out .= '<input type="submit" /></form>';
+               $out .= '<input type="submit" value="' . wfMsgHtml( 'allpagessubmit' ) . '" /></form>';
                // congratulations the form is now build
                return $out;    
        }
@@ -152,7 +176,6 @@ class ListUsersPage extends QueryPage {
        }
 
        function formatResult( $skin, $result ) {
-               global $wgContLang;
                
                $userPage = Title::makeTitle( $result->namespace, $result->title );
                $name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
@@ -183,18 +206,21 @@ class ListUsersPage extends QueryPage {
 
 /**
  * constructor
+ * $par string (optional) A group to list users from
  */
-function wfSpecialListusers() {
+function wfSpecialListusers( $par = null ) {
        global $wgRequest;
 
        list( $limit, $offset ) = wfCheckLimits();
 
+
        $slu = new ListUsersPage();
        
        /**
         * Get some parameters
         */
-       $slu->requestedGroup = $wgRequest->getVal('group');
+       $groupTarget = isset($par) ? $par : $wgRequest->getVal( 'group' );
+       $slu->requestedGroup = $groupTarget;
        $slu->requestedUser = $wgRequest->getVal('username');
 
        return $slu->doQuery( $offset, $limit );