Index: trunk/extensions/GlobalUsage/GlobalUsageQuery.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | private $reversed = false; |
14 | 14 | |
15 | 15 | /** |
16 | | - * @param $target mixed Title or db key, or array of db keys of target(s). |
| 16 | + * @param $target mixed Title or array of db keys of target(s). |
17 | 17 | * If a title, can be a category or a file |
18 | 18 | */ |
19 | 19 | public function __construct( $target ) { |
— | — | @@ -113,20 +113,22 @@ |
114 | 114 | $tables = array( 'globalimagelinks' ); |
115 | 115 | |
116 | 116 | // Add target image(s) |
117 | | - if ( is_array( $this->target ) ) { |
| 117 | + if ( is_array( $this->target ) ) { // array of dbkey strings |
118 | 118 | $namespace = NS_FILE; |
119 | | - } else { |
| 119 | + $queryIn = $this->target; |
| 120 | + } else { // a Title object |
120 | 121 | $namespace = $this->target->getNamespace(); |
| 122 | + $queryIn = $this->target->getDbKey(); |
121 | 123 | } |
122 | 124 | switch ( $namespace ) { |
123 | 125 | case NS_FILE: |
124 | | - $where = array( 'gil_to' => $this->target ); |
| 126 | + $where = array( 'gil_to' => $queryIn ); |
125 | 127 | break; |
126 | 128 | case NS_CATEGORY: |
127 | 129 | $tables[] = 'categorylinks'; |
128 | 130 | $tables[] = 'page'; |
129 | 131 | $where = array( |
130 | | - 'cl_to' => $this->target->getDbKey(), |
| 132 | + 'cl_to' => $queryIn, |
131 | 133 | 'cl_from = page_id', |
132 | 134 | 'page_namespace = ' . NS_FILE, |
133 | 135 | 'gil_to = page_title', |