Merge "Add missing return value"
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index 65aa07e..f4c6f51 100644 (file)
@@ -227,7 +227,8 @@ class SpecialContributions extends SpecialPage {
         * Generates the subheading with links
         * @param $userObj User object for the target
         * @return String: appropriately-escaped HTML to be output literally
-        * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
+        * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php.
+        * Could be combined.
         */
        protected function contributionsSub( $userObj ) {
                if ( $userObj->isAnon() ) {
@@ -594,9 +595,11 @@ class SpecialContributions extends SpecialPage {
  */
 class ContribsPager extends ReverseChronologicalPager {
        public $mDefaultDirection = true;
-       var $messages, $target;
-       var $namespace = '', $mDb;
-       var $preventClickjacking = false;
+       public $messages;
+       public $target;
+       public $namespace = '';
+       public $mDb;
+       public $preventClickjacking = false;
 
        /**
         * @var array
@@ -679,8 +682,13 @@ class ContribsPager extends ReverseChronologicalPager {
                 * $limit: see phpdoc above
                 * $descending: see phpdoc above
                 */
-               $data = array( $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds ) );
-               wfRunHooks( 'ContribsPager::reallyDoQuery', array( &$data, $pager, $offset, $limit, $descending ) );
+               $data = array( $this->mDb->select(
+                       $tables, $fields, $conds, $fname, $options, $join_conds
+               ) );
+               wfRunHooks(
+                       'ContribsPager::reallyDoQuery',
+                       array( &$data, $pager, $offset, $limit, $descending )
+               );
 
                $result = array();
 
@@ -727,6 +735,11 @@ class ContribsPager extends ReverseChronologicalPager {
                # Get the current user name for accounts
                $join_cond['user'] = Revision::userJoinCond();
 
+               $options = array();
+               if ( $index ) {
+                       $options['USE INDEX'] = array( 'revision' => $index );
+               }
+
                $queryInfo = array(
                        'tables' => $tables,
                        'fields' => array_merge(
@@ -736,7 +749,7 @@ class ContribsPager extends ReverseChronologicalPager {
                                        'page_latest', 'page_is_redirect', 'page_len' )
                        ),
                        'conds' => $conds,
-                       'options' => array( 'USE INDEX' => array( 'revision' => $index ) ),
+                       'options' => $options,
                        'join_conds' => $join_cond
                );
 
@@ -758,10 +771,10 @@ class ContribsPager extends ReverseChronologicalPager {
                $condition = array();
                $join_conds = array();
                $tables = array( 'revision', 'page', 'user' );
+               $index = false;
                if ( $this->contribs == 'newbie' ) {
                        $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
                        $condition[] = 'rev_user >' . (int)( $max - $max / 100 );
-                       $index = 'user_timestamp';
                        # ignore local groups with the bot right
                        # @todo FIXME: Global groups may have 'bot' rights
                        $groupsWithBotPermission = User::getGroupsWithPermission( 'bot' );
@@ -944,7 +957,11 @@ class ContribsPager extends ReverseChronologicalPager {
                                $chardiff .= Linker::formatRevisionSize( $row->rev_len );
                                $chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
                        } else {
-                               $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? $this->mParentLens[$row->rev_parent_id] : 0;
+                               $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 .= ChangesList::showCharacterDifference(
                                        $parentLen,
@@ -974,7 +991,7 @@ class ContribsPager extends ReverseChronologicalPager {
                        # Show user names for /newbies as there may be different users.
                        # Note that we already excluded rows with hidden user names.
                        if ( $this->contribs == 'newbie' ) {
-                               $userlink = ' . . ' . Linker::userLink( $rev->getUser(), $rev->getUserText() );
+                               $userlink = ' . . ' . $lang->getDirMark() . Linker::userLink( $rev->getUser(), $rev->getUserText() );
                                $userlink .= ' ' . $this->msg( 'parentheses' )->rawParams(
                                        Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';
                        } else {
@@ -1001,11 +1018,14 @@ class ContribsPager extends ReverseChronologicalPager {
                        $diffHistLinks = $this->msg( 'parentheses' )
                                ->rawParams( $difftext . $this->messages['pipe-separator'] . $histlink )
                                ->escaped();
-                       $ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
+                       $ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} ";
+                       $ret .= "{$link}{$userlink} {$comment} {$topmarktext}";
 
                        # Denote if username is redacted for this edit
                        if ( $rev->isDeleted( Revision::DELETED_USER ) ) {
-                               $ret .= " <strong>" . $this->msg( 'rev-deleted-user-contribs' )->escaped() . "</strong>";
+                               $ret .= " <strong>" .
+                                       $this->msg( 'rev-deleted-user-contribs' )->escaped() .
+                                       "</strong>";
                        }
 
                        # Tags, if any.