jenkins-bot has submitted this change and it was merged.

Change subject: Reorder SpecialRecentChanges::webOutput
......................................................................


Reorder SpecialRecentChanges::webOutput

Reordered the function to separate the data building logic and actual
outputting.

I'd love to actually split them in two functions, but the two parts
are still slightly interdependent and passing everything as arguments
would be awkward.

Change-Id: If770640d5b79e8771470bb7b6d1fcc16060f06b0
---
M includes/specials/SpecialRecentchanges.php
1 file changed, 30 insertions(+), 27 deletions(-)

Approvals:
  Parent5446: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialRecentchanges.php 
b/includes/specials/SpecialRecentchanges.php
index d263202..a408beb 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -488,27 +488,15 @@
        public function webOutput( $rows, $opts ) {
                global $wgRCShowWatchingUsers, $wgShowUpdatedMarker, 
$wgAllowCategorizedRecentChanges;
 
-               $limit = $opts['limit'];
-
-               if ( !$this->including() ) {
-                       // Output options box
-                       $this->doHeader( $opts );
-               }
-
-               // And now for the content
-               $feedQuery = $this->getFeedQuery();
-               if ( $feedQuery !== '' ) {
-                       $this->getOutput()->setFeedAppendQuery( $feedQuery );
-               } else {
-                       $this->getOutput()->setFeedAppendQuery( false );
-               }
+               // Build the final data
 
                if ( $wgAllowCategorizedRecentChanges ) {
                        $this->filterByCategories( $rows, $opts );
                }
 
-               $showNumsWachting = $this->getUser()->getOption( 
'shownumberswatching' );
-               $showWatcherCount = $wgRCShowWatchingUsers && $showNumsWachting;
+               $limit = $opts['limit'];
+
+               $showWatcherCount = $wgRCShowWatchingUsers && 
$this->getUser()->getOption( 'shownumberswatching' );
                $watcherCache = array();
 
                $dbr = wfGetDB( DB_SLAVE );
@@ -516,14 +504,7 @@
                $counter = 1;
                $list = ChangesList::newFromContext( $this->getContext() );
 
-               if ( $rows->numRows() === 0 ) {
-                       $this->getOutput()->wrapWikiMsg(
-                               "<div 
class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
-                       );
-                       return;
-               }
-
-               $s = $list->beginRecentChangesList();
+               $rclistOutput = $list->beginRecentChangesList();
                foreach ( $rows as $obj ) {
                        if ( $limit == 0 ) {
                                break;
@@ -556,12 +537,34 @@
 
                        $changeLine = $list->recentChangesLine( $rc, !empty( 
$obj->wl_user ), $counter );
                        if ( $changeLine !== false ) {
-                               $s .= $changeLine;
+                               $rclistOutput .= $changeLine;
                                --$limit;
                        }
                }
-               $s .= $list->endRecentChangesList();
-               $this->getOutput()->addHTML( $s );
+               $rclistOutput .= $list->endRecentChangesList();
+
+               // Print things out
+
+               if ( !$this->including() ) {
+                       // Output options box
+                       $this->doHeader( $opts );
+               }
+
+               // And now for the content
+               $feedQuery = $this->getFeedQuery();
+               if ( $feedQuery !== '' ) {
+                       $this->getOutput()->setFeedAppendQuery( $feedQuery );
+               } else {
+                       $this->getOutput()->setFeedAppendQuery( false );
+               }
+
+               if ( $rows->numRows() === 0 ) {
+                       $this->getOutput()->wrapWikiMsg(
+                               "<div 
class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
+                       );
+               } else {
+                       $this->getOutput()->addHTML( $rclistOutput );
+               }
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/65325
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If770640d5b79e8771470bb7b6d1fcc16060f06b0
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Matmarex <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to