Index: trunk/phase3/includes/GlobalUsageQuery.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | 4 | * A helper class to query the globalimagelinks table |
5 | | - * |
| 5 | + * |
6 | 6 | */ |
7 | 7 | class GlobalUsageQuery { |
8 | 8 | private $limit = 50; |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | private $continue; |
14 | 14 | private $reversed = false; |
15 | 15 | private $target = null; |
16 | | - |
| 16 | + |
17 | 17 | /** |
18 | 18 | * @param $target mixed Title or db key, or array of db keys of target(s) |
19 | 19 | */ |
— | — | @@ -25,7 +25,6 @@ |
26 | 26 | $this->target = $target; |
27 | 27 | } |
28 | 28 | $this->offset = array(); |
29 | | - |
30 | 29 | } |
31 | 30 | |
32 | 31 | /** |
— | — | @@ -38,7 +37,7 @@ |
39 | 38 | if ( !is_null( $reversed ) ) { |
40 | 39 | $this->reversed = $reversed; |
41 | 40 | } |
42 | | - |
| 41 | + |
43 | 42 | if ( !is_array( $offset ) ) { |
44 | 43 | $offset = explode( '|', $offset ); |
45 | 44 | } |
— | — | @@ -60,18 +59,18 @@ |
61 | 60 | } |
62 | 61 | /** |
63 | 62 | * Is the result reversed |
64 | | - * |
| 63 | + * |
65 | 64 | * @return bool |
66 | 65 | */ |
67 | 66 | public function isReversed() { |
68 | 67 | return $this->reversed; |
69 | 68 | } |
70 | | - |
| 69 | + |
71 | 70 | /** |
72 | 71 | * Returns the string used for continuation in a file search |
73 | | - * |
| 72 | + * |
74 | 73 | * @return string |
75 | | - * |
| 74 | + * |
76 | 75 | */ |
77 | 76 | public function getContinueFileString() { |
78 | 77 | if ( $this->hasMore() ) { |
— | — | @@ -80,7 +79,7 @@ |
81 | 80 | return ''; |
82 | 81 | } |
83 | 82 | } |
84 | | - |
| 83 | + |
85 | 84 | /** |
86 | 85 | * Returns the string used for continuation in a template search |
87 | 86 | * |
— | — | @@ -94,7 +93,7 @@ |
95 | 94 | return ''; |
96 | 95 | } |
97 | 96 | } |
98 | | - |
| 97 | + |
99 | 98 | /** |
100 | 99 | * Set the maximum amount of items to return. Capped at 500. |
101 | 100 | * |
— | — | @@ -228,7 +227,7 @@ |
229 | 228 | /* Construct a where clause */ |
230 | 229 | // Add target image(s) |
231 | 230 | $where = array( 'gil_to' => $this->target ); |
232 | | - |
| 231 | + |
233 | 232 | if ( $this->filterLocal ) { |
234 | 233 | // Don't show local file usage |
235 | 234 | $where[] = 'gil_wiki != ' . $this->db->addQuotes( wfWikiId() ); |
— | — | @@ -240,7 +239,7 @@ |
241 | 240 | $qTo = $this->db->addQuotes( $this->offset[0] ); |
242 | 241 | $qWiki = $this->db->addQuotes( $this->offset[1] ); |
243 | 242 | $qPage = intval( $this->offset[2] ); |
244 | | - |
| 243 | + |
245 | 244 | // Check which limit we got in order to determine which way to traverse rows |
246 | 245 | if ( $this->reversed ) { |
247 | 246 | // Reversed traversal; do not include offset row |
— | — | @@ -253,7 +252,7 @@ |
254 | 253 | $op2 = '>='; |
255 | 254 | $order = 'ASC'; |
256 | 255 | } |
257 | | - |
| 256 | + |
258 | 257 | $where[] = "(gil_to $op1 $qTo) OR " . |
259 | 258 | "(gil_to = $qTo AND gil_wiki $op1 $qWiki) OR " . |
260 | 259 | "(gil_to = $qTo AND gil_wiki = $qWiki AND gil_page $op2 $qPage)"; |
— | — | @@ -287,7 +286,7 @@ |
288 | 287 | if ( $this->reversed ) { |
289 | 288 | $rows = array_reverse( $rows ); |
290 | 289 | } |
291 | | - |
| 290 | + |
292 | 291 | // Build the result array |
293 | 292 | $count = 0; |
294 | 293 | $this->hasMore = false; |
— | — | @@ -321,12 +320,12 @@ |
322 | 321 | /** |
323 | 322 | * Returns the result set. The result is a 4 dimensional array |
324 | 323 | * (file, wiki, page), whose items are arrays with keys: |
325 | | - * - image or template: File name or template name |
| 324 | + * - image or template: File name or template name |
326 | 325 | * - id: Page id |
327 | 326 | * - namespace: Page namespace text |
328 | 327 | * - title: Unprefixed page title |
329 | 328 | * - wiki: Wiki id |
330 | | - * |
| 329 | + * |
331 | 330 | * @return array Result set |
332 | 331 | */ |
333 | 332 | public function getResult() { |
— | — | @@ -335,9 +334,9 @@ |
336 | 335 | /** |
337 | 336 | * Returns a 3 dimensional array with the result of the first file. Useful |
338 | 337 | * if only one resource was queried. |
339 | | - * |
| 338 | + * |
340 | 339 | * For further information see documentation of getResult() |
341 | | - * |
| 340 | + * |
342 | 341 | * @return array Result set |
343 | 342 | */ |
344 | 343 | public function getSingleResult() { |
— | — | @@ -359,7 +358,7 @@ |
360 | 359 | |
361 | 360 | /** |
362 | 361 | * Returns the result length |
363 | | - * |
| 362 | + * |
364 | 363 | * @return int |
365 | 364 | */ |
366 | 365 | public function count() { |
Index: trunk/phase3/includes/specials/SpecialGlobalFileUsage.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | |
26 | 26 | $this->showForm(); |
27 | 27 | |
28 | | - if ( is_null( $this->target ) ) { |
| 28 | + if ( is_null( $this->target ) ) { |
29 | 29 | $wgOut->setPageTitle( wfMsg( 'globalfileusage' ) ); |
30 | 30 | return; |
31 | 31 | } |
— | — | @@ -129,6 +129,7 @@ |
130 | 130 | // Bottom navbar |
131 | 131 | $wgOut->addHtml( $navbar ); |
132 | 132 | } |
| 133 | + |
133 | 134 | /** |
134 | 135 | * Helper to format a specific item |
135 | 136 | */ |