Merge "Do not output invalid links for deleted names on Special:Contributions"
[lhc/web/wiklou.git] / includes / specials / pagers / ContribsPager.php
index a4740a4..e583108 100644 (file)
@@ -24,6 +24,9 @@
  * @ingroup Pager
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
+use Wikimedia\Rdbms\IDatabase;
 
 class ContribsPager extends ReverseChronologicalPager {
 
@@ -42,6 +45,11 @@ class ContribsPager extends ReverseChronologicalPager {
         */
        protected $mParentLens;
 
+       /**
+        * @var TemplateParser
+        */
+       protected $templateParser;
+
        function __construct( IContextSource $context, array $options ) {
                parent::__construct( $context );
 
@@ -77,6 +85,7 @@ class ContribsPager extends ReverseChronologicalPager {
                // queries should use a regular replica DB since the lookup pattern is not all by user.
                $this->mDbSecondary = wfGetDB( DB_REPLICA ); // any random replica DB
                $this->mDb = wfGetDB( DB_REPLICA, 'contributions' );
+               $this->templateParser = new TemplateParser();
        }
 
        function getDefaultQuery() {
@@ -160,7 +169,7 @@ class ContribsPager extends ReverseChronologicalPager {
                $user = $this->getUser();
                $conds = array_merge( $userCond, $this->getNamespaceCond() );
 
-               // Paranoia: avoid brute force searches (bug 17342)
+               // Paranoia: avoid brute force searches (T19342)
                if ( !$user->isAllowed( 'deletedhistory' ) ) {
                        $conds[] = $this->mDb->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0';
                } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
@@ -225,10 +234,8 @@ class ContribsPager extends ReverseChronologicalPager {
                                        'LEFT JOIN', [
                                                'ug_user = rev_user',
                                                'ug_group' => $groupsWithBotPermission,
-                                               $this->getConfig()->get( 'DisableUserGroupExpiry' ) ?
-                                                       '1' :
-                                                       'ug_expiry IS NULL OR ug_expiry >= ' .
-                                                               $this->mDb->addQuotes( $this->mDb->timestamp() )
+                                               'ug_expiry IS NULL OR ug_expiry >= ' .
+                                                       $this->mDb->addQuotes( $this->mDb->timestamp() )
                                        ]
                                ];
                        }
@@ -420,7 +427,7 @@ class ContribsPager extends ReverseChronologicalPager {
 
                        if ( $row->rev_parent_id === null ) {
                                // For some reason rev_parent_id isn't populated for this row.
-                               // Its rumoured this is true on wikipedia for some revisions (bug 34922).
+                               // Its rumoured this is true on wikipedia for some revisions (T36922).
                                // Next best thing is to have the total number of bytes.
                                $chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
                                $chardiff .= Linker::formatRevisionSize( $row->rev_len );
@@ -514,8 +521,7 @@ class ContribsPager extends ReverseChronologicalPager {
                                        $this->msg( 'rev-deleted-user-contribs' )->escaped();
                        }
 
-                       $templateParser = new TemplateParser();
-                       $ret = $templateParser->processTemplate(
+                       $ret = $this->templateParser->processTemplate(
                                'SpecialContributionsLine',
                                $templateParams
                        );