r38212 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38211‎ | r38212 | r38213 >
Date:03:05, 30 July 2008
Author:demon
Status:old
Tags:
Comment:
Remove unused $wgServer global.
Modified paths:
  • /trunk/phase3/includes/ImageQueryPage.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImageQueryPage.php
@@ -9,6 +9,8 @@
1010 */
1111 class ImageQueryPage extends QueryPage {
1212
 13+ var $mIsGallery = true;
 14+
1315 /**
1416 * Format and output report results using the given information plus
1517 * OutputPage
@@ -22,19 +24,36 @@
2325 */
2426 protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
2527 if( $num > 0 ) {
26 - $gallery = new ImageGallery();
27 - $gallery->useSkin( $skin );
28 -
29 - # $res might contain the whole 1,000 rows, so we read up to
30 - # $num [should update this to use a Pager]
31 - for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
32 - $image = $this->prepareImage( $row );
33 - if( $image ) {
34 - $gallery->add( $image->getTitle(), $this->getCellHtml( $row ) );
 28+ if ( $this->mIsGallery ) {
 29+ $gallery = new ImageGallery();
 30+ $gallery->useSkin( $skin );
 31+
 32+ # $res might contain the whole 1,000 rows, so we read up to
 33+ # $num [should update this to use a Pager]
 34+ for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
 35+ $image = $this->prepareImage( $row );
 36+ if( $image ) {
 37+ $gallery->add( $image->getTitle(), $this->getCellHtml( $row ) );
 38+ }
3539 }
 40+ $html = $gallery->toHtml();
3641 }
 42+ else {
 43+ global $wgUser, $wgLang;
 44+ $sk = $wgUser->getSkin();
 45+ $html = "<ol>\n";
 46+ for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
 47+ $image = $this->prepareImage( $row );
 48+ if( $image ) {
 49+ $bytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'), $wgLang->formatNum( $image->getSize() ) );
 50+ $html .= "<li>" . $sk->makeKnownLinkObj( $image->getTitle(), $image->getTitle()->getText() ) .
 51+ " (" . $bytes . ")</li>\n";
 52+ }
 53+ }
 54+ $html .= "</ol>\n";
 55+ }
3756
38 - $out->addHtml( $gallery->toHtml() );
 57+ $out->addHtml( $html );
3958 }
4059 }
4160
@@ -51,7 +70,7 @@
5271 ? wfFindFile( $title )
5372 : null;
5473 }
55 -
 74+
5675 /**
5776 * Get additional HTML to be shown in a results' cell
5877 *
@@ -61,5 +80,11 @@
6281 protected function getCellHtml( $row ) {
6382 return '';
6483 }
65 -
 84+
 85+ /**
 86+ * Is this to be output as a gallery?
 87+ */
 88+ public function setGallery( $val ) {
 89+ $this->mIsGallery = $val;
 90+ }
6691 }
Index: trunk/phase3/includes/OutputPage.php
@@ -744,7 +744,7 @@
745745 global $wgUser, $wgOutputEncoding, $wgRequest;
746746 global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
747747 global $wgJsMimeType, $wgUseAjax, $wgAjaxSearch, $wgAjaxWatch;
748 - global $wgServer, $wgEnableMWSuggest;
 748+ global $wgEnableMWSuggest;
749749
750750 if( $this->mDoNothing ){
751751 return;

Follow-up revisions

RevisionCommit summaryAuthorDate
r38213Bah! Partial revert of r38212. Unrelated file snuck into my commit window.demon03:07, 30 July 2008

Status & tagging log