From f2dbd70b442ca00b65f74b81dbea265d0eb840b6 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 4 Sep 2007 15:13:55 +0000 Subject: [PATCH] Moved removeBadFile() to the base class --- includes/media/Generic.php | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/includes/media/Generic.php b/includes/media/Generic.php index a0707c2570..c7ab7d81db 100644 --- a/includes/media/Generic.php +++ b/includes/media/Generic.php @@ -232,6 +232,28 @@ abstract class MediaHandler { * Modify the parser object post-transform */ function parserTransformHook( $parser, $file ) {} + + /** + * Check for zero-sized thumbnails. These can be generated when + * no disk space is available or some other error occurs + * + * @param $dstPath The location of the suspect file + * @param $retval Return value of some shell process, file will be deleted if this is non-zero + * @return true if removed, false otherwise + */ + function removeBadFile( $dstPath, $retval = 0 ) { + if( file_exists( $dstPath ) ) { + $thumbstat = stat( $dstPath ); + if( $thumbstat['size'] == 0 || $retval != 0 ) { + wfDebugLog( 'thumbnail', + sprintf( 'Removing bad %d-byte thumbnail "%s"', + $thumbstat['size'], $dstPath ) ); + unlink( $dstPath ); + return true; + } + } + return false; + } } /** @@ -353,28 +375,6 @@ abstract class ImageHandler extends MediaHandler { return new ThumbnailImage( $image, $url, $params['width'], $params['height'], $page ); } - /** - * Check for zero-sized thumbnails. These can be generated when - * no disk space is available or some other error occurs - * - * @param $dstPath The location of the suspect file - * @param $retval Return value of some shell process, file will be deleted if this is non-zero - * @return true if removed, false otherwise - */ - function removeBadFile( $dstPath, $retval = 0 ) { - if( file_exists( $dstPath ) ) { - $thumbstat = stat( $dstPath ); - if( $thumbstat['size'] == 0 || $retval != 0 ) { - wfDebugLog( 'thumbnail', - sprintf( 'Removing bad %d-byte thumbnail "%s"', - $thumbstat['size'], $dstPath ) ); - unlink( $dstPath ); - return true; - } - } - return false; - } - function getImageSize( $image, $path ) { wfSuppressWarnings(); $gis = getimagesize( $path ); -- 2.20.1