r44834 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44833‎ | r44834 | r44835 >
Date:08:36, 20 December 2008
Author:aaron
Status:ok
Tags:
Comment:
Minor code cleanup
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRecentchanges.php
@@ -82,9 +82,9 @@
8383
8484 # 10 seconds server-side caching max
8585 $wgOut->setSquidMaxage( 10 );
86 -
 86+ # Check if the client has a cached version
8787 $lastmod = $this->checkLastModified( $feedFormat );
88 - if( $lastmod === false ){
 88+ if( $lastmod === false ) {
8989 return;
9090 }
9191
@@ -94,7 +94,6 @@
9595
9696 // Fetch results, prepare a batch link existence check query
9797 $rows = array();
98 - $batch = new LinkBatch;
9998 $conds = $this->buildMainQueryConds( $opts );
10099 $rows = $this->doMainQuery( $conds, $opts );
101100 if( $rows === false ){
@@ -104,19 +103,19 @@
105104 return;
106105 }
107106
108 - foreach( $rows as $row ) {
109 - if( !$feedFormat ) {
110 - // User page and talk links
 107+ if( !$feedFormat ) {
 108+ $batch = new LinkBatch;
 109+ foreach( $rows as $row ) {
111110 $batch->add( NS_USER, $row->rc_user_text );
112111 $batch->add( NS_USER_TALK, $row->rc_user_text );
113112 }
 113+ $batch->execute();
114114 }
115115
116116 if( $feedFormat ) {
117117 list( $feed, $feedObj ) = $this->getFeedObject( $feedFormat );
118118 $feed->execute( $feedObj, $rows, $opts['limit'], $opts['hideminor'], $lastmod );
119119 } else {
120 - $batch->execute();
121120 $this->webOutput( $rows, $opts );
122121 }
123122
@@ -349,17 +348,16 @@
350349
351350 $s = $list->beginRecentChangesList();
352351 foreach( $rows as $obj ) {
353 - if( $limit == 0 ) {
354 - break;
355 - }
 352+ if( $limit == 0 ) break;
356353 $rc = RecentChange::newFromRow( $obj );
357354 $rc->counter = $counter++;
358 -
359 - $rc->notificationtimestamp = false; // Default
 355+ # Check if the page has been updated since the last visit
360356 if( $wgShowUpdatedMarker && !empty($obj->wl_notificationtimestamp) ) {
361357 $rc->notificationtimestamp = ($obj->rc_timestamp >= $obj->wl_notificationtimestamp);
 358+ } else {
 359+ $rc->notificationtimestamp = false; // Default
362360 }
363 -
 361+ # Check the number of users watching the page
364362 $rc->numberofWatchingusers = 0; // Default
365363 if( $showWatcherCount && $obj->rc_namespace >= 0 ) {
366364 if( !isset($watcherCache[$obj->rc_namespace][$obj->rc_title]) ) {

Status & tagging log