Replace usages of deprecated User::isAllowed. Step 2.
[lhc/web/wiklou.git] / includes / specials / pagers / ContribsPager.php
index 152f56b..3a56a87 100644 (file)
@@ -24,6 +24,7 @@
  * @ingroup Pager
  */
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Linker\LinkRenderer;
 use MediaWiki\Storage\RevisionRecord;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\FakeResultWrapper;
@@ -97,7 +98,9 @@ class ContribsPager extends RangeChronologicalPager {
         */
        private $templateParser;
 
-       public function __construct( IContextSource $context, array $options ) {
+       public function __construct( IContextSource $context, array $options,
+               LinkRenderer $linkRenderer = null
+       ) {
                // Set ->target before calling parent::__construct() so
                // parent can call $this->getIndexField() and get the right result. Set
                // the rest too just to keep things simple.
@@ -112,7 +115,7 @@ class ContribsPager extends RangeChronologicalPager {
                $this->newOnly = !empty( $options['newOnly'] );
                $this->hideMinor = !empty( $options['hideMinor'] );
 
-               parent::__construct( $context );
+               parent::__construct( $context, $linkRenderer );
 
                $msgs = [
                        'diff',
@@ -266,6 +269,7 @@ class ContribsPager extends RangeChronologicalPager {
                        'options' => [],
                        'join_conds' => $revQuery['joins'],
                ];
+               $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
 
                // WARNING: Keep this in sync with getTargetTable()!
                $user = User::newFromName( $this->target, false );
@@ -310,14 +314,11 @@ class ContribsPager extends RangeChronologicalPager {
                $queryInfo['conds'] = array_merge( $queryInfo['conds'], $this->getNamespaceCond() );
 
                // Paranoia: avoid brute force searches (T19342)
-               if ( !$user->isAllowed( 'deletedhistory' ) ) {
+               if ( !$permissionManager->userHasRight( $user, 'deletedhistory' ) ) {
                        $queryInfo['conds'][] = $this->mDb->bitAnd(
                                'rev_deleted', RevisionRecord::DELETED_USER
                                ) . ' = 0';
-               } elseif ( !MediaWikiServices::getInstance()
-                       ->getPermissionManager()
-                       ->userHasAnyRight( $user, 'suppressrevision', 'viewsuppressed' )
-               ) {
+               } elseif ( !$permissionManager->userHasAnyRight( $user, 'suppressrevision', 'viewsuppressed' ) ) {
                        $queryInfo['conds'][] = $this->mDb->bitAnd(
                                'rev_deleted', RevisionRecord::SUPPRESSED_USER
                                ) . ' != ' . RevisionRecord::SUPPRESSED_USER;