Merge "TitleInputWidget: Correct links when 'relative' option used"
[lhc/web/wiklou.git] / includes / specials / SpecialBlockList.php
index 4583430..8a9aefd 100644 (file)
@@ -113,11 +113,6 @@ class SpecialBlockList extends SpecialPage {
        }
 
        function showList() {
-               # Purge expired entries on one in every 10 queries
-               if ( !mt_rand( 0, 10 ) ) {
-                       Block::purgeExpired();
-               }
-
                $conds = array();
                # Is the user allowed to see hidden blocks?
                if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
@@ -398,6 +393,10 @@ class BlockListPager extends TablePager {
                        'join_conds' => array( 'user' => array( 'LEFT JOIN', 'user_id = ipb_by' ) )
                );
 
+               # Filter out any expired blocks
+               $db = $this->getDatabase();
+               $info['conds'][] = 'ipb_expiry > ' . $db->addQuotes( $db->timestamp() );
+
                # Is the user allowed to see hidden blocks?
                if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
                        $info['conds']['ipb_deleted'] = 0;
@@ -431,23 +430,14 @@ class BlockListPager extends TablePager {
                $lb = new LinkBatch;
                $lb->setCaller( __METHOD__ );
 
-               $userids = array();
-
                foreach ( $result as $row ) {
-                       $userids[] = $row->ipb_by;
+                       $lb->add( NS_USER, $row->ipb_address );
+                       $lb->add( NS_USER_TALK, $row->ipb_address );
 
-                       # Usernames and titles are in fact related by a simple substitution of space -> underscore
-                       # The last few lines of Title::secureAndSplit() tell the story.
-                       $name = str_replace( ' ', '_', $row->ipb_address );
-                       $lb->add( NS_USER, $name );
-                       $lb->add( NS_USER_TALK, $name );
-               }
-
-               $ua = UserArray::newFromIDs( $userids );
-               foreach ( $ua as $user ) {
-                       $name = str_replace( ' ', '_', $user->getName() );
-                       $lb->add( NS_USER, $name );
-                       $lb->add( NS_USER_TALK, $name );
+                       if ( isset( $row->by_user_name ) ) {
+                               $lb->add( NS_USER, $row->by_user_name );
+                               $lb->add( NS_USER_TALK, $row->by_user_name );
+                       }
                }
 
                $lb->execute();