Index: trunk/phase3/includes/api/ApiQueryImageInfo.php |
— | — | @@ -81,6 +81,10 @@ |
82 | 82 | $result = $this->getResult(); |
83 | 83 | $images = RepoGroup::singleton()->findFiles( $titles ); |
84 | 84 | foreach ( $images as $img ) { |
| 85 | + // Skip redirects |
| 86 | + if($img->getOriginalTitle()->isRedirect()) |
| 87 | + continue; |
| 88 | + |
85 | 89 | $start = $skip ? $fromTimestamp : $params['start']; |
86 | 90 | $pageId = $pageIds[NS_IMAGE][ $img->getOriginalTitle()->getDBkey() ]; |
87 | 91 | |
— | — | @@ -158,13 +162,14 @@ |
159 | 163 | $skip = false; |
160 | 164 | } |
161 | 165 | |
162 | | - $missing = array_diff( array_keys( $pageIds[NS_FILE] ), array_keys( $images ) ); |
163 | | - foreach ($missing as $title) { |
164 | | - $result->addValue( |
165 | | - array('query', 'pages', intval($pageIds[NS_FILE][$title])), |
166 | | - 'imagerepository', '' |
167 | | - ); |
168 | | - // The above can't fail because it doesn't increase the result size |
| 166 | + $data = $this->getResultData(); |
| 167 | + foreach($data['query']['pages'] as $pageid => $arr) { |
| 168 | + if(!isset($arr['imagerepository'])) |
| 169 | + $result->addValue( |
| 170 | + array('query', 'pages', $pageid), |
| 171 | + 'imagerepository', '' |
| 172 | + ); |
| 173 | + // The above can't fail because it doesn't increase the result size |
169 | 174 | } |
170 | 175 | } |
171 | 176 | } |