Merge "Load installer i18n when running update.php"
[lhc/web/wiklou.git] / includes / specials / pagers / ContribsPager.php
index 59fa948..9900340 100644 (file)
@@ -221,14 +221,12 @@ class ContribsPager extends RangeChronologicalPager {
                                $conds = ActorMigration::newMigration()->getWhere( $this->mDb, 'rev_user', $user );
                                $queryInfo['conds'][] = $conds['conds'];
                                // Force the appropriate index to avoid bad query plans (T189026)
-                               if ( count( $conds['orconds'] ) === 1 ) {
-                                       if ( isset( $conds['orconds']['actor'] ) ) {
-                                               // @todo: This will need changing when revision_comment_temp goes away
-                                               $queryInfo['options']['USE INDEX']['temp_rev_user'] = 'actor_timestamp';
-                                       } else {
-                                               $queryInfo['options']['USE INDEX']['revision'] =
-                                                       isset( $conds['orconds']['userid'] ) ? 'user_timestamp' : 'usertext_timestamp';
-                                       }
+                               if ( isset( $conds['orconds']['actor'] ) ) {
+                                       // @todo: This will need changing when revision_comment_temp goes away
+                                       $queryInfo['options']['USE INDEX']['temp_rev_user'] = 'actor_timestamp';
+                               } else {
+                                       $queryInfo['options']['USE INDEX']['revision'] =
+                                               isset( $conds['orconds']['userid'] ) ? 'user_timestamp' : 'usertext_timestamp';
                                }
                        }
                }
@@ -407,24 +405,13 @@ class ContribsPager extends RangeChronologicalPager {
        }
 
        /**
-        * Generates each row in the contributions list.
+        * Check whether the revision associated is valid for formatting. If has no associated revision
+        * id then null is returned.
         *
-        * Contributions which are marked "top" are currently on top of the history.
-        * For these contributions, a [rollback] link is shown for users with roll-
-        * back privileges. The rollback link restores the most recent version that
-        * was not written by the target user.
-        *
-        * @todo This would probably look a lot nicer in a table.
         * @param object $row
-        * @return string
+        * @return Revision|null
         */
-       function formatRow( $row ) {
-               $ret = '';
-               $classes = [];
-               $attribs = [];
-
-               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
-
+       public function tryToCreateValidRevision( $row ) {
                /*
                 * There may be more than just revision rows. To make sure that we'll only be processing
                 * revisions here, let's _try_ to build a revision out of our row (without displaying
@@ -440,8 +427,30 @@ class ContribsPager extends RangeChronologicalPager {
                        $validRevision = false;
                }
                Wikimedia\restoreWarnings();
+               return $validRevision ? $rev : null;
+       }
+
+       /**
+        * Generates each row in the contributions list.
+        *
+        * Contributions which are marked "top" are currently on top of the history.
+        * For these contributions, a [rollback] link is shown for users with roll-
+        * back privileges. The rollback link restores the most recent version that
+        * was not written by the target user.
+        *
+        * @todo This would probably look a lot nicer in a table.
+        * @param object $row
+        * @return string
+        */
+       function formatRow( $row ) {
+               $ret = '';
+               $classes = [];
+               $attribs = [];
+
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
 
-               if ( $validRevision ) {
+               $rev = $this->tryToCreateValidRevision( $row );
+               if ( $rev ) {
                        $attribs['data-mw-revid'] = $rev->getId();
 
                        $page = Title::newFromRow( $row );
@@ -491,22 +500,22 @@ class ContribsPager extends RangeChronologicalPager {
                                // For some reason rev_parent_id isn't populated for this row.
                                // 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 = ' <span class="mw-changeslist-separator"></span> ';
                                $chardiff .= Linker::formatRevisionSize( $row->rev_len );
-                               $chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
+                               $chardiff .= ' <span class="mw-changeslist-separator"></span> ';
                        } else {
                                $parentLen = 0;
                                if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) {
                                        $parentLen = $this->mParentLens[$row->rev_parent_id];
                                }
 
-                               $chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
+                               $chardiff = ' <span class="mw-changeslist-separator"></span> ';
                                $chardiff .= ChangesList::showCharacterDifference(
                                        $parentLen,
                                        $row->rev_len,
                                        $this->getContext()
                                );
-                               $chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
+                               $chardiff .= ' <span class="mw-changeslist-separator"></span> ';
                        }
 
                        $lang = $this->getLanguage();
@@ -532,7 +541,8 @@ class ContribsPager extends RangeChronologicalPager {
                        $userlink = '';
                        if ( ( $this->contribs == 'newbie' && !$rev->isDeleted( Revision::DELETED_USER ) )
                                || $this->isQueryableRange( $this->target ) ) {
-                               $userlink = ' . . ' . $lang->getDirMark()
+                               $userlink = ' <span class="mw-changeslist-separator"></span> '
+                                       . $lang->getDirMark()
                                        . Linker::userLink( $rev->getUser(), $rev->getUserText() );
                                $userlink .= ' ' . $this->msg( 'parentheses' )->rawParams(
                                        Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';