r69811 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69810‎ | r69811 | r69812 >
Date:20:01, 23 July 2010
Author:simetrical
Status:ok
Tags:
Comment:
Use modern coding constructs and a better var name

foreach ( $res as $row ), Title::newFromRow(), $row instead of $x.
Modified paths:
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CategoryPage.php
@@ -262,23 +262,23 @@
263263 $count = 0;
264264 $this->nextPage = null;
265265
266 - while ( $x = $dbr->fetchObject ( $res ) ) {
 266+ foreach ( $res as $row ) {
267267 if ( ++$count > $this->limit ) {
268268 // We've reached the one extra which shows that there are
269269 // additional pages to be had. Stop here...
270 - $this->nextPage = $x->cl_sortkey;
 270+ $this->nextPage = $row->cl_sortkey;
271271 break;
272272 }
273273
274 - $title = Title::makeTitle( $x->page_namespace, $x->page_title );
 274+ $title = Title::newFromRow( $row );
275275
276276 if ( $title->getNamespace() == NS_CATEGORY ) {
277 - $cat = Category::newFromRow( $x, $title );
278 - $this->addSubcategoryObject( $cat, $x->cl_sortkey, $x->page_len );
 277+ $cat = Category::newFromRow( $row, $title );
 278+ $this->addSubcategoryObject( $cat, $row->cl_sortkey, $row->page_len );
279279 } elseif ( $this->showGallery && $title->getNamespace() == NS_FILE ) {
280 - $this->addImage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect );
 280+ $this->addImage( $title, $row->cl_sortkey, $row->page_len, $row->page_is_redirect );
281281 } else {
282 - $this->addPage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect );
 282+ $this->addPage( $title, $row->cl_sortkey, $row->page_len, $row->page_is_redirect );
283283 }
284284 }
285285

Status & tagging log