Index: branches/iwtransclusion/phase3v3/includes/GlobalUsageQuery.php |
— | — | @@ -19,10 +19,11 @@ |
20 | 20 | public function __construct( $target ) { |
21 | 21 | global $wgGlobalDatabase; |
22 | 22 | $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 ) { |
24 | 24 | $this->target = $target->getDBKey(); |
25 | | - else |
| 25 | + } else { |
26 | 26 | $this->target = $target; |
| 27 | + } |
27 | 28 | $this->offset = array(); |
28 | 29 | |
29 | 30 | } |
— | — | @@ -34,11 +35,13 @@ |
35 | 36 | * @param $reversed bool True if this is the upper offset |
36 | 37 | */ |
37 | 38 | public function setOffset( $offset, $reversed = null ) { |
38 | | - if ( !is_null( $reversed ) ) |
| 39 | + if ( !is_null( $reversed ) ) { |
39 | 40 | $this->reversed = $reversed; |
| 41 | + } |
40 | 42 | |
41 | | - if ( !is_array( $offset ) ) |
| 43 | + if ( !is_array( $offset ) ) { |
42 | 44 | $offset = explode( '|', $offset ); |
| 45 | + } |
43 | 46 | |
44 | 47 | if ( count( $offset ) == 3 ) { |
45 | 48 | $this->offset = $offset; |
— | — | @@ -71,10 +74,11 @@ |
72 | 75 | * |
73 | 76 | */ |
74 | 77 | public function getContinueFileString() { |
75 | | - if ( $this->hasMore() ) |
| 78 | + if ( $this->hasMore() ) { |
76 | 79 | return "{$this->lastRow->gil_to}|{$this->lastRow->gil_wiki}|{$this->lastRow->gil_page}"; |
77 | | - else |
| 80 | + } else { |
78 | 81 | return ''; |
| 82 | + } |
79 | 83 | } |
80 | 84 | |
81 | 85 | /** |
— | — | @@ -84,10 +88,11 @@ |
85 | 89 | * |
86 | 90 | */ |
87 | 91 | public function getContinueTemplateString() { |
88 | | - if ( $this->hasMore() ) |
| 92 | + if ( $this->hasMore() ) { |
89 | 93 | return "{$this->lastRow->gtl_to_title}|{$this->lastRow->gtl_from_wiki}|{$this->lastRow->gtl_from_page}"; |
90 | | - else |
| 94 | + } else { |
91 | 95 | return ''; |
| 96 | + } |
92 | 97 | } |
93 | 98 | |
94 | 99 | /** |
— | — | @@ -217,9 +222,10 @@ |
218 | 223 | // Add target image(s) |
219 | 224 | $where = array( 'gil_to' => $this->target ); |
220 | 225 | |
221 | | - if ( $this->filterLocal ) |
| 226 | + if ( $this->filterLocal ) { |
222 | 227 | // Don't show local file usage |
223 | 228 | $where[] = 'gil_wiki != ' . $this->db->addQuotes( wfWikiId() ); |
| 229 | + } |
224 | 230 | |
225 | 231 | // Set the continuation condition |
226 | 232 | $order = 'ASC'; |
— | — | @@ -268,10 +274,12 @@ |
269 | 275 | // Always return the result in the same order; regardless whether reversed was specified |
270 | 276 | // reversed is really only used to determine from which direction the offset is |
271 | 277 | $rows = array(); |
272 | | - foreach ( $res as $row ) |
| 278 | + foreach ( $res as $row ) { |
273 | 279 | $rows[] = $row; |
274 | | - if ( $this->reversed ) |
| 280 | + } |
| 281 | + if ( $this->reversed ) { |
275 | 282 | $rows = array_reverse( $rows ); |
| 283 | + } |
276 | 284 | |
277 | 285 | // Build the result array |
278 | 286 | $count = 0; |
— | — | @@ -286,10 +294,12 @@ |
287 | 295 | break; |
288 | 296 | } |
289 | 297 | |
290 | | - if ( !isset( $this->result[$row->gil_to] ) ) |
| 298 | + if ( !isset( $this->result[$row->gil_to] ) ) { |
291 | 299 | $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] ) ) { |
293 | 302 | $this->result[$row->gil_to][$row->gil_wiki] = array(); |
| 303 | + } |
294 | 304 | |
295 | 305 | $this->result[$row->gil_to][$row->gil_wiki][] = array( |
296 | 306 | 'image' => $row->gil_to, |
Index: branches/iwtransclusion/phase3v3/includes/specials/SpecialGlobalTemplateUsage.php |
— | — | @@ -27,8 +27,7 @@ |
28 | 28 | |
29 | 29 | $this->showForm(); |
30 | 30 | |
31 | | - if ( is_null( $this->target ) ) |
32 | | - { |
| 31 | + if ( is_null( $this->target ) ) { |
33 | 32 | $wgOut->setPageTitle( wfMsg( 'globaltemplateusage' ) ); |
34 | 33 | return; |
35 | 34 | } |
Index: branches/iwtransclusion/phase3v3/includes/specials/SpecialGlobalFileUsage.php |
— | — | @@ -7,8 +7,6 @@ |
8 | 8 | class SpecialGlobalFileUsage extends SpecialPage { |
9 | 9 | public function __construct() { |
10 | 10 | parent::__construct( 'GlobalFileUsage', 'globalfileusage' ); |
11 | | - |
12 | | - wfLoadExtensionMessages( 'globalfileusage' ); |
13 | 11 | } |
14 | 12 | |
15 | 13 | /** |
— | — | @@ -26,8 +24,7 @@ |
27 | 25 | |
28 | 26 | $this->showForm(); |
29 | 27 | |
30 | | - if ( is_null( $this->target ) ) |
31 | | - { |
| 28 | + if ( is_null( $this->target ) ) { |
32 | 29 | $wgOut->setPageTitle( wfMsg( 'globalfileusage' ) ); |
33 | 30 | return; |
34 | 31 | } |
— | — | @@ -88,10 +85,11 @@ |
89 | 86 | $query = new GlobalUsageQuery( $this->target ); |
90 | 87 | |
91 | 88 | // Extract params from $wgRequest |
92 | | - if ( $wgRequest->getText( 'from' ) ) |
| 89 | + if ( $wgRequest->getText( 'from' ) ) { |
93 | 90 | $query->setOffset( $wgRequest->getText( 'from' ) ); |
94 | | - elseif ( $wgRequest->getText( 'to' ) ) |
| 91 | + } elseif ( $wgRequest->getText( 'to' ) ) { |
95 | 92 | $query->setOffset( $wgRequest->getText( 'to' ), true ); |
| 93 | + } |
96 | 94 | $query->setLimit( $wgRequest->getInt( 'limit', 50 ) ); |
97 | 95 | $query->filterLocal( $this->filterLocal ); |
98 | 96 | |
— | — | @@ -121,8 +119,9 @@ |
122 | 120 | 'globalfileusage-on-wiki', 'parseinline', |
123 | 121 | $targetName, WikiMap::getWikiName( $wiki ) ) |
124 | 122 | . "</h2><ul>\n" ); |
125 | | - foreach ( $result as $item ) |
| 123 | + foreach ( $result as $item ) { |
126 | 124 | $wgOut->addHtml( "\t<li>" . self::formatItem( $item ) . "</li>\n" ); |
| 125 | + } |
127 | 126 | $wgOut->addHtml( "</ul>\n" ); |
128 | 127 | } |
129 | 128 | $wgOut->addHtml( '</div>' ); |
— | — | @@ -134,10 +133,11 @@ |
135 | 134 | * Helper to format a specific item |
136 | 135 | */ |
137 | 136 | public static function formatItem( $item ) { |
138 | | - if ( !$item['namespace'] ) |
| 137 | + if ( !$item['namespace'] ) { |
139 | 138 | $page = $item['title']; |
140 | | - else |
| 139 | + } else { |
141 | 140 | $page = "{$item['namespace']}:{$item['title']}"; |
| 141 | + } |
142 | 142 | |
143 | 143 | $link = WikiMap::makeForeignLink( $item['wiki'], $page, |
144 | 144 | str_replace( '_', ' ', $page ) ); |
Index: branches/iwtransclusion/phase3v3/languages/messages/MessagesQqq.php |
— | — | @@ -4233,6 +4233,16 @@ |
4234 | 4234 | |
4235 | 4235 | {{Identical|Other}}', |
4236 | 4236 | |
| 4237 | +# Special:GlobalFileUsage |
| 4238 | +'globalfileusage-for' => '$1 is a file name', |
| 4239 | +'globalfileusage-no-results' => '$1 is a file name', |
| 4240 | +'globalfileusage-on-wiki' => '$2 is a wiki name', |
| 4241 | + |
| 4242 | +# Special:GlobalTemplateUsage |
| 4243 | +'globaltemplateusage-for' => '$1 is a template name', |
| 4244 | +'globaltemplateusage-no-results' => '$1 is a template name', |
| 4245 | +'globaltemplateusage-on-wiki' => '$2 is a wiki name', |
| 4246 | + |
4237 | 4247 | # SQLite database support |
4238 | 4248 | 'sqlite-has-fts' => 'Shown on Special:Version, $1 is version', |
4239 | 4249 | 'sqlite-no-fts' => 'Shown on Special:Version, $1 is version', |