From: Tim Starling Date: Tue, 4 Sep 2007 15:13:55 +0000 (+0000) Subject: Moved removeBadFile() to the base class X-Git-Tag: 1.31.0-rc.0~51524 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=f2dbd70b442ca00b65f74b81dbea265d0eb840b6;p=lhc%2Fweb%2Fwiklou.git Moved removeBadFile() to the base class --- 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 );