Index: trunk/phase3/includes/SpecialRecentchanges.php |
— | — | @@ -172,13 +172,9 @@ |
173 | 173 | while( $row = $dbr->fetchObject( $res ) ){ |
174 | 174 | $rows[] = $row; |
175 | 175 | if ( !$feedFormat ) { |
176 | | - // User page link |
177 | | - $title = Title::makeTitleSafe( NS_USER, $row->rc_user_text ); |
178 | | - $batch->addObj( $title ); |
179 | | - |
180 | | - // User talk |
181 | | - $title = Title::makeTitleSafe( NS_USER_TALK, $row->rc_user_text ); |
182 | | - $batch->addObj( $title ); |
| 176 | + // User page and talk links |
| 177 | + $batch->add( NS_USER, $row->rc_user_text ); |
| 178 | + $batch->add( NS_USER_TALK, $row->rc_user_text ); |
183 | 179 | } |
184 | 180 | |
185 | 181 | } |
— | — | @@ -231,6 +227,10 @@ |
232 | 228 | |
233 | 229 | $s = $list->beginRecentChangesList(); |
234 | 230 | $counter = 1; |
| 231 | + |
| 232 | + $showWatcherCount = $wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ); |
| 233 | + $watcherCache = array(); |
| 234 | + |
235 | 235 | foreach( $rows as $obj ){ |
236 | 236 | if( $limit == 0) { |
237 | 237 | break; |
— | — | @@ -249,13 +249,20 @@ |
250 | 250 | $rc->notificationtimestamp = false; |
251 | 251 | } |
252 | 252 | |
253 | | - if ($wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) { |
254 | | - $sql3 = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_title='" . $dbr->strencode($obj->rc_title) ."' AND wl_namespace=$obj->rc_namespace" ; |
255 | | - $res3 = $dbr->query( $sql3, 'wfSpecialRecentChanges'); |
256 | | - $x = $dbr->fetchObject( $res3 ); |
257 | | - $rc->numberofWatchingusers = $x->n; |
258 | | - } else { |
259 | | - $rc->numberofWatchingusers = 0; |
| 253 | + $rc->numberofWatchingusers = 0; // Default |
| 254 | + if ($showWatcherCount && $obj->rc_namespace >= 0) { |
| 255 | + if (!isset($watcherCache[$obj->rc_namespace][$obj->rc_title])) { |
| 256 | + $sql3 = |
| 257 | + 'SELECT COUNT(*) AS n ' . |
| 258 | + "FROM $watchlist " . |
| 259 | + "WHERE wl_title='{$dbr->strencode($obj->rc_title)}' " . |
| 260 | + "AND wl_namespace=$obj->rc_namespace" ; |
| 261 | + $res3 = $dbr->query( $sql3, __METHOD__ . '-watchers'); |
| 262 | + $x = $dbr->fetchObject( $res3 ); |
| 263 | + $watcherCache[$obj->rc_namespace][$obj->rc_title] = $x->n; |
| 264 | + $dbr->freeResult( $res3 ); |
| 265 | + } |
| 266 | + $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title]; |
260 | 267 | } |
261 | 268 | $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ) ); |
262 | 269 | --$limit; |