r92374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92373‎ | r92374 | r92375 >
Date:18:37, 16 July 2011
Author:btongminh
Status:ok
Tags:
Comment:
Fix regression from r80242 that broke ApiQueryGlobalUsage totally. Array values should not be converted to title but preserved.
Modified paths:
  • /trunk/extensions/GlobalUsage/GlobalUsageQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GlobalUsage/GlobalUsageQuery.php
@@ -20,6 +20,9 @@
2121 $this->db = wfGetDB( DB_SLAVE, array(), $wgGlobalUsageDatabase );
2222 if ( $target instanceof Title ) {
2323 $this->target = $target;
 24+ } elseif ( is_array( $target ) ) {
 25+ // List of files to query
 26+ $this->target = $target;
2427 } else {
2528 $this->target = Title::makeTitleSafe( NS_FILE, $target );
2629 }
@@ -107,7 +110,12 @@
108111 $tables = array( 'globalimagelinks' );
109112
110113 // Add target image(s)
111 - switch ( $this->target->getNamespace() ) {
 114+ if ( is_array( $this->target ) ) {
 115+ $namespace = NS_FILE;
 116+ } else {
 117+ $namespace = $this->target->getNamespace();
 118+ }
 119+ switch ( $namespace ) {
112120 case NS_FILE:
113121 $where = array( 'gil_to' => $this->target );
114122 break;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80242Add backend infrastructure to start querying by categorybtongminh09:40, 14 January 2011

Status & tagging log