r91150 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91149‎ | r91150 | r91151 >
Date:01:24, 30 June 2011
Author:reedy
Status:ok
Tags:
Comment:
Merge r86683 from 1.17wmf1
Modified paths:
  • /trunk/phase3/includes/ImagePage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImagePage.php
@@ -84,7 +84,7 @@
8585 if ( $this->getTitle()->getNamespace() != NS_FILE || ( isset( $diff ) && $diffOnly ) ) {
8686 return parent::view();
8787 }
88 -
 88+
8989 $this->loadFile();
9090
9191 if ( $this->getTitle()->getNamespace() == NS_FILE && $this->mPage->getFile()->getRedirected() ) {
@@ -94,7 +94,7 @@
9595 $wgRequest->setVal( 'diffonly', 'true' );
9696 return parent::view();
9797 } else {
98 - // mTitle is not the same as the redirect target so it is
 98+ // mTitle is not the same as the redirect target so it is
9999 // probably the redirect page itself. Fake the redirect symbol
100100 $wgOut->setPageTitle( $this->getTitle()->getPrefixedText() );
101101 $wgOut->addHTML( $this->viewRedirect( Title::makeTitle( NS_FILE, $this->mPage->getFile()->getName() ),
@@ -159,7 +159,7 @@
160160 # @todo FIXME: For some freaky reason, we can't redirect to foreign images.
161161 # Yet we return metadata about the target. Definitely an issue in the FileRepo
162162 $this->imageLinks();
163 -
 163+
164164 # Allow extensions to add something after the image links
165165 $html = '';
166166 wfRunHooks( 'ImagePageAfterImageLinks', array( $this, &$html ) );
@@ -204,9 +204,9 @@
205205 if ( $metadata ) {
206206 $r[] = '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>';
207207 }
208 -
 208+
209209 wfRunHooks( 'ImagePageShowTOC', array( $this, &$r ) );
210 -
 210+
211211 return '<ul id="filetoc">' . implode( "\n", $r ) . '</ul>';
212212 }
213213
@@ -318,12 +318,12 @@
319319 foreach ( $wgImageLimits as $size ) {
320320 if ( $size[0] < $width_orig && $size[1] < $height_orig &&
321321 $size[0] != $width && $size[1] != $height ) {
322 - $otherSizes[] = $this->makeSizeLink( $params, $size[0], $size[1] );
 322+ $otherSizes[] = $this->makeSizeLink( $params, $size[0], $size[1] );
323323 }
324324 }
325325 $msgsmall = wfMessage( 'show-big-image-preview' )->
326326 rawParams( $this->makeSizeLink( $params, $width, $height ) )->
327 - parse() . ' ' .
 327+ parse() . ' ' .
328328 wfMessage( 'show-big-image-other' )->
329329 rawParams( $wgLang->pipeList( $otherSizes ) )->parse();
330330 } else {
@@ -475,9 +475,9 @@
476476 }
477477 }
478478 }
479 -
 479+
480480 /**
481 - * Creates an thumbnail of specified size and returns an HTML link to it
 481+ * Creates an thumbnail of specified size and returns an HTML link to it
482482 * @param array $params Scaler parameters
483483 * @param int $width
484484 * @param int $height
@@ -491,7 +491,7 @@
492492 'href' => $thumbnail->getUrl(),
493493 'class' => 'mw-thumbnail-link'
494494 ), wfMessage( 'show-big-image-size' )->numParams(
495 - $thumbnail->getWidth(), $thumbnail->getHeight()
 495+ $thumbnail->getWidth(), $thumbnail->getHeight()
496496 )->parse() );
497497 } else {
498498 return '';
@@ -619,15 +619,15 @@
620620 array( 'page_namespace', 'page_title', 'page_is_redirect', 'il_to' ),
621621 array( 'il_to' => $target, 'il_from = page_id' ),
622622 __METHOD__,
623 - array( 'LIMIT' => $limit + 1 )
624 - );
 623+ array( 'LIMIT' => $limit + 1, 'ORDER BY' => 'il_from', )
 624+ );
625625 }
626 -
 626+
627627 protected function imageLinks() {
628628 global $wgUser, $wgOut, $wgLang;
629629
630630 $limit = 100;
631 -
 631+
632632 $res = $this->queryImageLinks( $this->getTitle()->getDbKey(), $limit + 1);
633633 $rows = array();
634634 $redirects = array();
@@ -638,10 +638,10 @@
639639 $rows[] = $row;
640640 }
641641 $count = count( $rows );
642 -
 642+
643643 $hasMore = $count > $limit;
644644 if ( !$hasMore && count( $redirects ) ) {
645 - $res = $this->queryImageLinks( array_keys( $redirects ),
 645+ $res = $this->queryImageLinks( array_keys( $redirects ),
646646 $limit - count( $rows ) + 1 );
647647 foreach ( $res as $row ) {
648648 $redirects[$row->il_to][] = $row;
@@ -658,7 +658,7 @@
659659 );
660660 return;
661661 }
662 -
 662+
663663 $wgOut->addHTML( "<div id='mw-imagepage-section-linkstoimage'>\n" );
664664 if ( !$hasMore ) {
665665 $wgOut->addWikiMsg( 'linkstoimage', $count );
@@ -687,7 +687,7 @@
688688 if ( $currentCount > $limit ) {
689689 break;
690690 }
691 -
 691+
692692 $link = $sk->linkKnown( Title::makeTitle( $element->page_namespace, $element->page_title ) );
693693 if ( !isset( $redirects[$element->page_title] ) ) {
694694 $liContents = $link;
@@ -698,7 +698,7 @@
699699 if ( $currentCount > $limit ) {
700700 break;
701701 }
702 -
 702+
703703 $link2 = $sk->linkKnown( Title::makeTitle( $row->page_namespace, $row->page_title ) );
704704 $ul .= Html::rawElement(
705705 'li',
@@ -707,7 +707,7 @@
708708 ) . "\n";
709709 }
710710 $ul .= '</ul>';
711 - $liContents = wfMessage( 'linkstoimage-redirect' )->rawParams(
 711+ $liContents = wfMessage( 'linkstoimage-redirect' )->rawParams(
712712 $link, $ul )->parse();
713713 }
714714 $wgOut->addHTML( Html::rawElement(
@@ -830,7 +830,7 @@
831831 /**
832832 * Callback for usort() to do link sorts by (namespace, title)
833833 * Function copied from Title::compare()
834 - *
 834+ *
835835 * @param $a object page to compare with
836836 * @param $b object page to compare with
837837 * @return Integer: result of string comparison, or namespace comparison
@@ -1096,7 +1096,7 @@
10971097 $wgLang->time( $timestamp, true ) ),
10981098 'file-link' => true,
10991099 );
1100 -
 1100+
11011101 if ( !$thumbnail ) {
11021102 return wfMsgHtml( 'filehist-nothumb' );
11031103 }
@@ -1141,7 +1141,7 @@
11421142 $this->mHist = array();
11431143 $this->mRange = array( 0, 0 ); // display range
11441144 }
1145 -
 1145+
11461146 function getTitle() {
11471147 return $this->mTitle;
11481148 }
@@ -1157,7 +1157,7 @@
11581158 function formatRow( $row ) {
11591159 return '';
11601160 }
1161 -
 1161+
11621162 function getBody() {
11631163 $s = '';
11641164 $this->doQuery();
@@ -1260,7 +1260,7 @@
12611261 }
12621262 $this->mQueryDone = true;
12631263 }
1264 -
 1264+
12651265 protected function preventClickjacking( $enable = true ) {
12661266 $this->preventClickjacking = $enable;
12671267 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86683define order explicitly, hints optimizer not to hit page firstmidom23:33, 21 April 2011

Status & tagging log