@@ 193-202 (lines=10) @@ | ||
190 | $srcPath = $image->getLocalRefPath(); |
|
191 | } |
|
192 | ||
193 | if ( $srcPath === false ) { // Failed to get local copy |
|
194 | wfDebugLog( 'thumbnail', |
|
195 | sprintf( 'Thumbnail failed on %s: could not get local copy of "%s"', |
|
196 | wfHostname(), $image->getName() ) ); |
|
197 | ||
198 | return new MediaTransformError( 'thumbnail_error', |
|
199 | $params['width'], $params['height'], |
|
200 | wfMessage( 'filemissing' )->text() |
|
201 | ); |
|
202 | } |
|
203 | ||
204 | # Use a subshell (brackets) to aggregate stderr from both pipeline commands |
|
205 | # before redirecting it to the overall stdout. This works in both Linux and Windows XP. |
@@ 213-222 (lines=10) @@ | ||
210 | $scalerParams['srcWidth'] = $thumbnailSource['width']; |
|
211 | $scalerParams['srcHeight'] = $thumbnailSource['height']; |
|
212 | ||
213 | if ( $scalerParams['srcPath'] === false ) { // Failed to get local copy |
|
214 | wfDebugLog( 'thumbnail', |
|
215 | sprintf( 'Thumbnail failed on %s: could not get local copy of "%s"', |
|
216 | wfHostname(), $image->getName() ) ); |
|
217 | ||
218 | return new MediaTransformError( 'thumbnail_error', |
|
219 | $scalerParams['clientWidth'], $scalerParams['clientHeight'], |
|
220 | wfMessage( 'filemissing' )->text() |
|
221 | ); |
|
222 | } |
|
223 | ||
224 | # Try a hook. Called "Bitmap" for historical reasons. |
|
225 | /** @var $mto MediaTransformOutput */ |
@@ 192-201 (lines=10) @@ | ||
189 | } |
|
190 | ||
191 | $srcPath = $image->getLocalRefPath(); |
|
192 | if ( $srcPath === false ) { // Failed to get local copy |
|
193 | wfDebugLog( 'thumbnail', |
|
194 | sprintf( 'Thumbnail failed on %s: could not get local copy of "%s"', |
|
195 | wfHostname(), $image->getName() ) ); |
|
196 | ||
197 | return new MediaTransformError( 'thumbnail_error', |
|
198 | $params['width'], $params['height'], |
|
199 | wfMessage( 'filemissing' )->text() |
|
200 | ); |
|
201 | } |
|
202 | ||
203 | // Make a temp dir with a symlink to the local copy in it. |
|
204 | // This plays well with rsvg-convert policy for external entities. |
|
@@ 216-224 (lines=9) @@ | ||
213 | rmdir( $tmpDir ); |
|
214 | MediaWiki\restoreWarnings(); |
|
215 | } ); |
|
216 | if ( !$ok ) { |
|
217 | wfDebugLog( 'thumbnail', |
|
218 | sprintf( 'Thumbnail failed on %s: could not link %s to %s', |
|
219 | wfHostname(), $lnPath, $srcPath ) ); |
|
220 | return new MediaTransformError( 'thumbnail_error', |
|
221 | $params['width'], $params['height'], |
|
222 | wfMessage( 'thumbnail-temp-create' )->text() |
|
223 | ); |
|
224 | } |
|
225 | ||
226 | $status = $this->rasterize( $lnPath, $dstPath, $physicalWidth, $physicalHeight, $lang ); |
|
227 | if ( $status === true ) { |