Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php |
— | — | @@ -175,7 +175,7 @@ |
176 | 176 | 'iiurlwidth' => $width, |
177 | 177 | 'iiurlheight' => $height, |
178 | 178 | 'prop' => 'imageinfo' ) ); |
179 | | - if( $info ) { |
| 179 | + if( $info && $info['thumburl'] ) { |
180 | 180 | wfDebug( __METHOD__ . " got remote thumb " . $info['thumburl'] . "\n" ); |
181 | 181 | return $info['thumburl']; |
182 | 182 | } else { |
— | — | @@ -197,7 +197,15 @@ |
198 | 198 | } |
199 | 199 | else { |
200 | 200 | $foreignUrl = $this->getThumbUrl( $name, $width, $height ); |
201 | | - |
| 201 | + if( !$foreignUrl ) { |
| 202 | + wfDebug( __METHOD__ . " Could not find thumburl\n" ); |
| 203 | + return false; |
| 204 | + } |
| 205 | + $thumb = Http::get( $foreignUrl ); |
| 206 | + if( !$thumb ) { |
| 207 | + wfDebug( __METHOD__ . " Could not download thumb\n" ); |
| 208 | + return false; |
| 209 | + } |
202 | 210 | // We need the same filename as the remote one :) |
203 | 211 | $fileName = rawurldecode( pathinfo( $foreignUrl, PATHINFO_BASENAME ) ); |
204 | 212 | $path = 'thumb/' . $this->getHashPath( $name ) . $name . "/"; |
— | — | @@ -205,7 +213,6 @@ |
206 | 214 | wfMkdirParents($wgUploadDirectory . '/' . $path); |
207 | 215 | } |
208 | 216 | $localUrl = $wgServer . $wgUploadPath . '/' . $path . $fileName; |
209 | | - $thumb = Http::get( $foreignUrl ); |
210 | 217 | # FIXME: Delete old thumbs that aren't being used. Maintenance script? |
211 | 218 | if( !file_put_contents($wgUploadDirectory . '/' . $path . $fileName, $thumb ) ) { |
212 | 219 | wfDebug( __METHOD__ . " could not write to thumb path\n" ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -762,6 +762,7 @@ |
763 | 763 | template parameter |
764 | 764 | * Truncate summary of page moves in revision comment field to avoid broken |
765 | 765 | multibyte characters |
| 766 | +* (bug 22540) ForeignApiRepos no longer try to store thumbnails that don't exist |
766 | 767 | |
767 | 768 | == API changes in 1.16 == |
768 | 769 | |