r87113 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87112‎ | r87113 | r87114 >
Date:00:59, 29 April 2011
Author:reedy
Status:deferred
Tags:
Comment:
Merge r74246
Modified paths:
  • /branches/iwtransclusion/phase3v2 (modified) (history)
  • /branches/iwtransclusion/phase3v2/includes/GlobalUsageQuery.php (modified) (history)
  • /branches/iwtransclusion/phase3v2/includes/specials/SpecialGlobalFileUsage.php (modified) (history)
  • /branches/iwtransclusion/phase3v2/includes/specials/SpecialGlobalTemplateUsage.php (modified) (history)
  • /branches/iwtransclusion/phase3v2/languages/messages/MessagesQqq.php (modified) (history)

Diff [purge]

Index: branches/iwtransclusion/phase3v2/includes/GlobalUsageQuery.php
@@ -19,10 +19,11 @@
2020 public function __construct( $target ) {
2121 global $wgGlobalDatabase;
2222 $this->db = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
23 - if ( $target instanceof Title && $target->getNamespace( ) == NS_FILE )
 23+ if ( $target instanceof Title && $target->getNamespace( ) == NS_FILE ) {
2424 $this->target = $target->getDBKey();
25 - else
 25+ } else {
2626 $this->target = $target;
 27+ }
2728 $this->offset = array();
2829
2930 }
@@ -34,11 +35,13 @@
3536 * @param $reversed bool True if this is the upper offset
3637 */
3738 public function setOffset( $offset, $reversed = null ) {
38 - if ( !is_null( $reversed ) )
 39+ if ( !is_null( $reversed ) ) {
3940 $this->reversed = $reversed;
 41+ }
4042
41 - if ( !is_array( $offset ) )
 43+ if ( !is_array( $offset ) ) {
4244 $offset = explode( '|', $offset );
 45+ }
4346
4447 if ( count( $offset ) == 3 ) {
4548 $this->offset = $offset;
@@ -71,10 +74,11 @@
7275 *
7376 */
7477 public function getContinueFileString() {
75 - if ( $this->hasMore() )
 78+ if ( $this->hasMore() ) {
7679 return "{$this->lastRow->gil_to}|{$this->lastRow->gil_wiki}|{$this->lastRow->gil_page}";
77 - else
 80+ } else {
7881 return '';
 82+ }
7983 }
8084
8185 /**
@@ -84,10 +88,11 @@
8589 *
8690 */
8791 public function getContinueTemplateString() {
88 - if ( $this->hasMore() )
 92+ if ( $this->hasMore() ) {
8993 return "{$this->lastRow->gtl_to_title}|{$this->lastRow->gtl_from_wiki}|{$this->lastRow->gtl_from_page}";
90 - else
 94+ } else {
9195 return '';
 96+ }
9297 }
9398
9499 /**
@@ -217,9 +222,10 @@
218223 // Add target image(s)
219224 $where = array( 'gil_to' => $this->target );
220225
221 - if ( $this->filterLocal )
 226+ if ( $this->filterLocal ) {
222227 // Don't show local file usage
223228 $where[] = 'gil_wiki != ' . $this->db->addQuotes( wfWikiId() );
 229+ }
224230
225231 // Set the continuation condition
226232 $order = 'ASC';
@@ -268,10 +274,12 @@
269275 // Always return the result in the same order; regardless whether reversed was specified
270276 // reversed is really only used to determine from which direction the offset is
271277 $rows = array();
272 - foreach ( $res as $row )
 278+ foreach ( $res as $row ) {
273279 $rows[] = $row;
274 - if ( $this->reversed )
 280+ }
 281+ if ( $this->reversed ) {
275282 $rows = array_reverse( $rows );
 283+ }
276284
277285 // Build the result array
278286 $count = 0;
@@ -286,10 +294,12 @@
287295 break;
288296 }
289297
290 - if ( !isset( $this->result[$row->gil_to] ) )
 298+ if ( !isset( $this->result[$row->gil_to] ) ) {
291299 $this->result[$row->gil_to] = array();
292 - if ( !isset( $this->result[$row->gil_to][$row->gil_wiki] ) )
 300+ }
 301+ if ( !isset( $this->result[$row->gil_to][$row->gil_wiki] ) ) {
293302 $this->result[$row->gil_to][$row->gil_wiki] = array();
 303+ }
294304
295305 $this->result[$row->gil_to][$row->gil_wiki][] = array(
296306 'image' => $row->gil_to,
Index: branches/iwtransclusion/phase3v2/includes/specials/SpecialGlobalTemplateUsage.php
@@ -27,8 +27,7 @@
2828
2929 $this->showForm();
3030
31 - if ( is_null( $this->target ) )
32 - {
 31+ if ( is_null( $this->target ) ) {
3332 $wgOut->setPageTitle( wfMsg( 'globaltemplateusage' ) );
3433 return;
3534 }
Index: branches/iwtransclusion/phase3v2/includes/specials/SpecialGlobalFileUsage.php
@@ -7,8 +7,6 @@
88 class SpecialGlobalFileUsage extends SpecialPage {
99 public function __construct() {
1010 parent::__construct( 'GlobalFileUsage', 'globalfileusage' );
11 -
12 - wfLoadExtensionMessages( 'globalfileusage' );
1311 }
1412
1513 /**
@@ -26,8 +24,7 @@
2725
2826 $this->showForm();
2927
30 - if ( is_null( $this->target ) )
31 - {
 28+ if ( is_null( $this->target ) ) {
3229 $wgOut->setPageTitle( wfMsg( 'globalfileusage' ) );
3330 return;
3431 }
@@ -88,10 +85,11 @@
8986 $query = new GlobalUsageQuery( $this->target );
9087
9188 // Extract params from $wgRequest
92 - if ( $wgRequest->getText( 'from' ) )
 89+ if ( $wgRequest->getText( 'from' ) ) {
9390 $query->setOffset( $wgRequest->getText( 'from' ) );
94 - elseif ( $wgRequest->getText( 'to' ) )
 91+ } elseif ( $wgRequest->getText( 'to' ) ) {
9592 $query->setOffset( $wgRequest->getText( 'to' ), true );
 93+ }
9694 $query->setLimit( $wgRequest->getInt( 'limit', 50 ) );
9795 $query->filterLocal( $this->filterLocal );
9896
@@ -121,8 +119,9 @@
122120 'globalfileusage-on-wiki', 'parseinline',
123121 $targetName, WikiMap::getWikiName( $wiki ) )
124122 . "</h2><ul>\n" );
125 - foreach ( $result as $item )
 123+ foreach ( $result as $item ) {
126124 $wgOut->addHtml( "\t<li>" . self::formatItem( $item ) . "</li>\n" );
 125+ }
127126 $wgOut->addHtml( "</ul>\n" );
128127 }
129128 $wgOut->addHtml( '</div>' );
@@ -134,10 +133,11 @@
135134 * Helper to format a specific item
136135 */
137136 public static function formatItem( $item ) {
138 - if ( !$item['namespace'] )
 137+ if ( !$item['namespace'] ) {
139138 $page = $item['title'];
140 - else
 139+ } else {
141140 $page = "{$item['namespace']}:{$item['title']}";
 141+ }
142142
143143 $link = WikiMap::makeForeignLink( $item['wiki'], $page,
144144 str_replace( '_', ' ', $page ) );
Index: branches/iwtransclusion/phase3v2/languages/messages/MessagesQqq.php
@@ -4135,6 +4135,16 @@
41364136
41374137 {{Identical|Other}}',
41384138
 4139+# Special:GlobalFileUsage
 4140+'globalfileusage-for' => '$1 is a file name',
 4141+'globalfileusage-no-results' => '$1 is a file name',
 4142+'globalfileusage-on-wiki' => '$2 is a wiki name',
 4143+
 4144+# Special:GlobalTemplateUsage
 4145+'globaltemplateusage-for' => '$1 is a template name',
 4146+'globaltemplateusage-no-results' => '$1 is a template name',
 4147+'globaltemplateusage-on-wiki' => '$2 is a wiki name',
 4148+
41394149 # SQLite database support
41404150 'sqlite-has-fts' => 'Shown on Special:Version, $1 is version',
41414151 'sqlite-no-fts' => 'Shown on Special:Version, $1 is version',
Property changes on: branches/iwtransclusion/phase3v2
___________________________________________________________________
Modified: svn:mergeinfo
41424152 Merged /branches/iwtransclusion/phase3:r74246

Follow-up revisions

RevisionCommit summaryAuthorDate
r92998Merge r87113, merge of r74246reedy18:36, 24 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r74246Correcting remarks about r74210peter1706:10, 4 October 2010

Status & tagging log