Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / includes / specials / pagers / BlockListPager.php
index 71cf787..01aed22 100644 (file)
@@ -22,7 +22,7 @@
 /**
  * @ingroup Pager
  */
-use MediaWiki\Block\BlockRestriction;
+use MediaWiki\Block\DatabaseBlock;
 use MediaWiki\Block\Restriction\Restriction;
 use MediaWiki\Block\Restriction\PageRestriction;
 use MediaWiki\Block\Restriction\NamespaceRestriction;
@@ -108,10 +108,10 @@ class BlockListPager extends TablePager {
                                if ( $row->ipb_auto ) {
                                        $formatted = $this->msg( 'autoblockid', $row->ipb_id )->parse();
                                } else {
-                                       list( $target, $type ) = Block::parseTarget( $row->ipb_address );
+                                       list( $target, $type ) = DatabaseBlock::parseTarget( $row->ipb_address );
                                        switch ( $type ) {
-                                               case Block::TYPE_USER:
-                                               case Block::TYPE_IP:
+                                               case DatabaseBlock::TYPE_USER:
+                                               case DatabaseBlock::TYPE_IP:
                                                        $formatted = Linker::userLink( $target->getId(), $target );
                                                        $formatted .= Linker::userToolLinks(
                                                                $target->getId(),
@@ -120,7 +120,7 @@ class BlockListPager extends TablePager {
                                                                Linker::TOOL_LINKS_NOBLOCK
                                                        );
                                                        break;
-                                               case Block::TYPE_RANGE:
+                                               case DatabaseBlock::TYPE_RANGE:
                                                        $formatted = htmlspecialchars( $target );
                                        }
                                }
@@ -250,6 +250,7 @@ class BlockListPager extends TablePager {
         */
        private function getRestrictionListHTML( stdClass $row ) {
                $items = [];
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
 
                foreach ( $this->restrictions as $restriction ) {
                        if ( $restriction->getBlockId() !== (int)$row->ipb_id ) {
@@ -262,20 +263,20 @@ class BlockListPager extends TablePager {
                                                $items[$restriction->getType()][] = Html::rawElement(
                                                        'li',
                                                        [],
-                                                       Linker::link( $restriction->getTitle() )
+                                                       $linkRenderer->makeLink( $restriction->getTitle() )
                                                );
                                        }
                                        break;
                                case NamespaceRestriction::TYPE:
                                        $text = $restriction->getValue() === NS_MAIN
-                                               ? $this->msg( 'blanknamespace' )
+                                               ? $this->msg( 'blanknamespace' )->text()
                                                : $this->getLanguage()->getFormattedNsText(
                                                        $restriction->getValue()
                                                );
                                        $items[$restriction->getType()][] = Html::rawElement(
                                                'li',
                                                [],
-                                               Linker::link(
+                                               $linkRenderer->makeLink(
                                                        SpecialPage::getTitleValueFor( 'Allpages' ),
                                                        $text,
                                                        [],
@@ -364,7 +365,7 @@ class BlockListPager extends TablePager {
        function getTotalAutoblocks() {
                $dbr = $this->getDatabase();
                $res = $dbr->selectField( 'ipblocks',
-                       [ 'COUNT(*) AS totalautoblocks' ],
+                       'COUNT(*)',
                        [
                                'ipb_auto' => '1',
                                'ipb_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() ),
@@ -419,7 +420,8 @@ class BlockListPager extends TablePager {
                if ( $partialBlocks ) {
                        // Mutations to the $row object are not persisted. The restrictions will
                        // need be stored in a separate store.
-                       $this->restrictions = BlockRestriction::loadByBlockId( $partialBlocks );
+                       $blockRestrictionStore = MediaWikiServices::getInstance()->getBlockRestrictionStore();
+                       $this->restrictions = $blockRestrictionStore->loadByBlockId( $partialBlocks );
                }
 
                $lb->execute();