r51517 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51516‎ | r51517 | r51518 >
Date:20:16, 5 June 2009
Author:catrope
Status:deferred
Tags:
Comment:
querypage-work: Minor fixes for QueryPage.php
Modified paths:
  • /branches/querypage-work/phase3/includes/QueryPage.php (modified) (history)

Diff [purge]

Index: branches/querypage-work/phase3/includes/QueryPage.php
@@ -33,10 +33,10 @@
3434 array( 'MostrevisionsPage', 'Mostrevisions' ),
3535 array( 'FewestrevisionsPage', 'Fewestrevisions' ),
3636 array( 'ShortPagesPage', 'Shortpages' ),
37 - array( 'UncategorizedCategoriesPage', 'Uncategorizedcategories' ),
38 - array( 'UncategorizedPagesPage', 'Uncategorizedpages' ),
39 - array( 'UncategorizedImagesPage', 'Uncategorizedimages' ),
40 - array( 'UncategorizedTemplatesPage', 'Uncategorizedtemplates' ),
 37+ array( 'UncategorizedcategoriesPage', 'Uncategorizedcategories' ),
 38+ array( 'UncategorizedpagesPage', 'Uncategorizedpages' ),
 39+ array( 'UncategorizedimagesPage', 'Uncategorizedimages' ),
 40+ array( 'UncategorizedtemplatesPage', 'Uncategorizedtemplates' ),
4141 array( 'UnusedCategoriesPage', 'Unusedcategories' ),
4242 array( 'UnusedimagesPage', 'Unusedimages' ),
4343 array( 'WantedCategoriesPage', 'Wantedcategories' ),
@@ -82,13 +82,6 @@
8383 var $shownavigation = true;
8484
8585 /**
86 - * Constructor
87 - */
88 - public function __construct() {
89 - parent::__construct( $this->getName() );
90 - }
91 -
92 - /**
9386 * A mutator for $this->listoutput;
9487 *
9588 * @param bool $bool
@@ -98,14 +91,6 @@
9992 }
10093
10194 /**
102 - * Subclasses return their name here. Make sure the name is also
103 - * specified in SpecialPage.php and in Language.php as a language
104 - * message param.
105 - */
106 - abstract function getName();
107 - }
108 -
109 - /**
11095 * Return title object representing this page
11196 *
11297 * @return Title
@@ -380,23 +365,23 @@
381366 * real, honest-to-gosh query page.
382367 */
383368 function execute( $par ) {
384 - global $wgUser, $wgOut, $wgLang, $wgContLang;
385 -
386 - list( $this->offset, $this->limit ) = wfCheckLimits();
387 -
 369+ global $wgUser, $wgOut, $wgLang;
 370+
 371+ list( $this->limit, $this->offset ) = wfCheckLimits();
388372 $sname = $this->getName();
389 - $fname = get_class($this) . '::doQuery';
 373+ $fname = get_class( $this ) . '::doQuery';
390374 $dbr = wfGetDB( DB_SLAVE );
391375
 376+ $this->setHeaders();
392377 $wgOut->setSyndicated( $this->isSyndicated() );
393378
394379 // TODO: Use doQuery()
395380 //$res = null;
396381 if ( !$this->isCached() ) {
397 - $res = $this->reallyDoQuery( $limit, $offset );
 382+ $res = $this->reallyDoQuery( $this->limit, $this->offset );
398383 } else {
399384 # Get the cached result
400 - $res = $this->fetchFromCache( $limit, $offset );
 385+ $res = $this->fetchFromCache( $this->limit, $this->offset );
401386 if( !$this->listoutput ) {
402387
403388 # Fetch the timestamp of this update
@@ -433,10 +418,11 @@
434419 if( $this->shownavigation ) {
435420 $wgOut->addHTML( $this->getPageHeader() );
436421 if( $num > 0 ) {
437 - $wgOut->addHTML( '<p>' . wfShowingResults( $offset, $num ) . '</p>' );
 422+ $wgOut->addHTML( '<p>' . wfShowingResults( $this->offset, $num ) . '</p>' );
438423 # Disable the "next" link when we reach the end
439 - $paging = wfViewPrevNext( $offset, $limit, $wgContLang->specialPage( $sname ),
440 - wfArrayToCGI( $this->linkParameters() ), ( $num < $limit ) );
 424+ $paging = wfViewPrevNext( $this->offset, $this->limit,
 425+ $this->getTitle( $par ),
 426+ wfArrayToCGI( $this->linkParameters() ), ( $num < $this->limit ) );
441427 $wgOut->addHTML( '<p>' . $paging . '</p>' );
442428 } else {
443429 # No results to show, so don't bother with "showing X of Y" etc.
@@ -455,10 +441,10 @@
456442 $dbr, # Should use a ResultWrapper for this
457443 $res,
458444 $dbr->numRows( $res ),
459 - $offset );
 445+ $this->offset );
460446
461447 # Repeat the paging links at the bottom
462 - if( $shownavigation ) {
 448+ if( $this->shownavigation ) {
463449 $wgOut->addHTML( '<p>' . $paging . '</p>' );
464450 }
465451

Follow-up revisions

RevisionCommit summaryAuthorDate
r65325querypage-work2: Merge r51517reedy14:28, 20 April 2010

Status & tagging log