media: Mark public MediaHandler/ImageHandler methods as such
Note I'm intentionally not touching the entire file, but only methods I'm absolutely sure are already called from outside, e.g. from MediaHandlerFactory, and must be public because of this. I'm intentionally not doing anything with private or protected in this patch, as such changes are much more fragile. This is a direct follow up for the changes proposed in Iaa4f60d. Change-Id: Ida817b289ddd5e9a8c162cc1fa3335c639a0bbe5
This commit is contained in:
parent
4d0773cd01
commit
867ec07040
15 changed files with 43 additions and 43 deletions
|
|
@ -91,7 +91,7 @@ class BitmapHandler extends TransformationalImageHandler {
|
|||
* @param array &$params
|
||||
* @return bool
|
||||
*/
|
||||
function normaliseParams( $image, &$params ) {
|
||||
public function normaliseParams( $image, &$params ) {
|
||||
global $wgMaxInterlacingAreas;
|
||||
if ( !parent::normaliseParams( $image, $params ) ) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class BitmapHandler_ClientOnly extends BitmapHandler {
|
|||
* @param array &$params
|
||||
* @return bool
|
||||
*/
|
||||
function normaliseParams( $image, &$params ) {
|
||||
public function normaliseParams( $image, &$params ) {
|
||||
return ImageHandler::normaliseParams( $image, $params );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class BmpHandler extends BitmapHandler {
|
|||
* @param array|null $params
|
||||
* @return array
|
||||
*/
|
||||
function getThumbType( $text, $mime, $params = null ) {
|
||||
public function getThumbType( $text, $mime, $params = null ) {
|
||||
return [ 'png', 'image/png' ];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class DjVuHandler extends ImageHandler {
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isEnabled() {
|
||||
public function isEnabled() {
|
||||
global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML;
|
||||
if ( !$wgDjvuRenderer || ( !$wgDjvuDump && !$wgDjvuToXML ) ) {
|
||||
wfDebug( "DjVu is disabled, please set \$wgDjvuRenderer and \$wgDjvuDump\n" );
|
||||
|
|
@ -353,7 +353,7 @@ class DjVuHandler extends ImageHandler {
|
|||
return $this->getDjVuImage( $image, $path )->getImageSize();
|
||||
}
|
||||
|
||||
function getThumbType( $ext, $mime, $params = null ) {
|
||||
public function getThumbType( $ext, $mime, $params = null ) {
|
||||
global $wgDjvuOutputExtension;
|
||||
static $mime;
|
||||
if ( !isset( $mime ) ) {
|
||||
|
|
@ -364,7 +364,7 @@ class DjVuHandler extends ImageHandler {
|
|||
return [ $wgDjvuOutputExtension, $mime ];
|
||||
}
|
||||
|
||||
function getMetadata( $image, $path ) {
|
||||
public function getMetadata( $image, $path ) {
|
||||
wfDebug( "Getting DjVu metadata for $path\n" );
|
||||
|
||||
$xml = $this->getDjVuImage( $image, $path )->retrieveMetaData();
|
||||
|
|
@ -380,17 +380,17 @@ class DjVuHandler extends ImageHandler {
|
|||
return 'djvuxml';
|
||||
}
|
||||
|
||||
function isMetadataValid( $image, $metadata ) {
|
||||
public function isMetadataValid( $image, $metadata ) {
|
||||
return !empty( $metadata ) && $metadata != serialize( [] );
|
||||
}
|
||||
|
||||
function pageCount( File $image ) {
|
||||
public function pageCount( File $image ) {
|
||||
$info = $this->getDimensionInfo( $image );
|
||||
|
||||
return $info ? $info['pageCount'] : false;
|
||||
}
|
||||
|
||||
function getPageDimensions( File $image, $page ) {
|
||||
public function getPageDimensions( File $image, $page ) {
|
||||
$index = $page - 1; // MW starts pages at 1
|
||||
|
||||
$info = $this->getDimensionInfo( $image );
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class ExifBitmapHandler extends BitmapHandler {
|
|||
* @param array $metadata
|
||||
* @return bool|int
|
||||
*/
|
||||
function isMetadataValid( $image, $metadata ) {
|
||||
public function isMetadataValid( $image, $metadata ) {
|
||||
global $wgShowEXIF;
|
||||
if ( !$wgShowEXIF ) {
|
||||
# Metadata disabled and so an empty field is expected
|
||||
|
|
@ -127,7 +127,7 @@ class ExifBitmapHandler extends BitmapHandler {
|
|||
* @param bool|IContextSource $context Context to use (optional)
|
||||
* @return array|bool
|
||||
*/
|
||||
function formatMetadata( $image, $context = false ) {
|
||||
public function formatMetadata( $image, $context = false ) {
|
||||
$meta = $this->getCommonMetaArray( $image );
|
||||
if ( count( $meta ) === 0 ) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
class GIFHandler extends BitmapHandler {
|
||||
const BROKEN_FILE = '0'; // value to store in img_metadata if error extracting metadata.
|
||||
|
||||
function getMetadata( $image, $filename ) {
|
||||
public function getMetadata( $image, $filename ) {
|
||||
try {
|
||||
$parsedGIFMetadata = BitmapMetadataHandler::GIF( $filename );
|
||||
} catch ( Exception $e ) {
|
||||
|
|
@ -47,7 +47,7 @@ class GIFHandler extends BitmapHandler {
|
|||
* @param bool|IContextSource $context Context to use (optional)
|
||||
* @return array|bool
|
||||
*/
|
||||
function formatMetadata( $image, $context = false ) {
|
||||
public function formatMetadata( $image, $context = false ) {
|
||||
$meta = $this->getCommonMetaArray( $image );
|
||||
if ( count( $meta ) === 0 ) {
|
||||
return false;
|
||||
|
|
@ -125,7 +125,7 @@ class GIFHandler extends BitmapHandler {
|
|||
return 'parsed-gif';
|
||||
}
|
||||
|
||||
function isMetadataValid( $image, $metadata ) {
|
||||
public function isMetadataValid( $image, $metadata ) {
|
||||
if ( $metadata === self::BROKEN_FILE ) {
|
||||
// Do not repetitivly regenerate metadata on broken file.
|
||||
return self::METADATA_GOOD;
|
||||
|
|
@ -156,7 +156,7 @@ class GIFHandler extends BitmapHandler {
|
|||
* @param File $image
|
||||
* @return string
|
||||
*/
|
||||
function getLongDesc( $image ) {
|
||||
public function getLongDesc( $image ) {
|
||||
global $wgLang;
|
||||
|
||||
$original = parent::getLongDesc( $image );
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ abstract class ImageHandler extends MediaHandler {
|
|||
* @param File $file
|
||||
* @return string
|
||||
*/
|
||||
function getLongDesc( $file ) {
|
||||
public function getLongDesc( $file ) {
|
||||
global $wgLang;
|
||||
$pages = $file->pageCount();
|
||||
$size = htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class JpegHandler extends ExifBitmapHandler {
|
|||
const SRGB_EXIF_COLOR_SPACE = 'sRGB';
|
||||
const SRGB_ICC_PROFILE_DESCRIPTION = 'sRGB IEC61966-2.1';
|
||||
|
||||
function normaliseParams( $image, &$params ) {
|
||||
public function normaliseParams( $image, &$params ) {
|
||||
if ( !parent::normaliseParams( $image, $params ) ) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ class JpegHandler extends ExifBitmapHandler {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function getMetadata( $image, $filename ) {
|
||||
public function getMetadata( $image, $filename ) {
|
||||
try {
|
||||
$meta = BitmapMetadataHandler::Jpeg( $filename );
|
||||
if ( !is_array( $meta ) ) {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ abstract class MediaHandler {
|
|||
* @param File $image
|
||||
* @param array &$params
|
||||
*/
|
||||
abstract function normaliseParams( $image, &$params );
|
||||
abstract public function normaliseParams( $image, &$params );
|
||||
|
||||
/**
|
||||
* Get an image size array like that returned by getimagesize(), or false if it
|
||||
|
|
@ -119,7 +119,7 @@ abstract class MediaHandler {
|
|||
* @param string $path The filename
|
||||
* @return string A string of metadata in php serialized form (Run through serialize())
|
||||
*/
|
||||
function getMetadata( $image, $path ) {
|
||||
public function getMetadata( $image, $path ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ abstract class MediaHandler {
|
|||
* @param string $metadata The metadata in serialized form
|
||||
* @return bool
|
||||
*/
|
||||
function isMetadataValid( $image, $metadata ) {
|
||||
public function isMetadataValid( $image, $metadata ) {
|
||||
return self::METADATA_GOOD;
|
||||
}
|
||||
|
||||
|
|
@ -287,7 +287,7 @@ abstract class MediaHandler {
|
|||
* @param array|null $params Handler specific rendering parameters
|
||||
* @return array Thumbnail extension and MIME type
|
||||
*/
|
||||
function getThumbType( $ext, $mime, $params = null ) {
|
||||
public function getThumbType( $ext, $mime, $params = null ) {
|
||||
$magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
|
||||
if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) {
|
||||
// The extension is not valid for this MIME type and we do
|
||||
|
|
@ -340,7 +340,7 @@ abstract class MediaHandler {
|
|||
* @param File $file
|
||||
* @return bool
|
||||
*/
|
||||
function pageCount( File $file ) {
|
||||
public function pageCount( File $file ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ abstract class MediaHandler {
|
|||
* False if the handler is disabled for all files
|
||||
* @return bool
|
||||
*/
|
||||
function isEnabled() {
|
||||
public function isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ abstract class MediaHandler {
|
|||
* @param int $page What page to get dimensions of
|
||||
* @return array|bool
|
||||
*/
|
||||
function getPageDimensions( File $image, $page ) {
|
||||
public function getPageDimensions( File $image, $page ) {
|
||||
$gis = $this->getImageSize( $image, $image->getLocalRefPath() );
|
||||
if ( $gis ) {
|
||||
return [
|
||||
|
|
@ -477,7 +477,7 @@ abstract class MediaHandler {
|
|||
* @param bool|IContextSource $context Context to use (optional)
|
||||
* @return array|bool
|
||||
*/
|
||||
function formatMetadata( $image, $context = false ) {
|
||||
public function formatMetadata( $image, $context = false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -582,7 +582,7 @@ abstract class MediaHandler {
|
|||
* @param File $file
|
||||
* @return string
|
||||
*/
|
||||
function getLongDesc( $file ) {
|
||||
public function getLongDesc( $file ) {
|
||||
return self::getGeneralLongDesc( $file );
|
||||
}
|
||||
|
||||
|
|
@ -660,7 +660,7 @@ abstract class MediaHandler {
|
|||
* @param string $fileName The local path to the file.
|
||||
* @return Status
|
||||
*/
|
||||
function verifyUpload( $fileName ) {
|
||||
public function verifyUpload( $fileName ) {
|
||||
return Status::newGood();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class PNGHandler extends BitmapHandler {
|
|||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
function getMetadata( $image, $filename ) {
|
||||
public function getMetadata( $image, $filename ) {
|
||||
try {
|
||||
$metadata = BitmapMetadataHandler::PNG( $filename );
|
||||
} catch ( Exception $e ) {
|
||||
|
|
@ -52,7 +52,7 @@ class PNGHandler extends BitmapHandler {
|
|||
* @param bool|IContextSource $context Context to use (optional)
|
||||
* @return array|bool
|
||||
*/
|
||||
function formatMetadata( $image, $context = false ) {
|
||||
public function formatMetadata( $image, $context = false ) {
|
||||
$meta = $this->getCommonMetaArray( $image );
|
||||
if ( count( $meta ) === 0 ) {
|
||||
return false;
|
||||
|
|
@ -111,7 +111,7 @@ class PNGHandler extends BitmapHandler {
|
|||
return 'parsed-png';
|
||||
}
|
||||
|
||||
function isMetadataValid( $image, $metadata ) {
|
||||
public function isMetadataValid( $image, $metadata ) {
|
||||
if ( $metadata === self::BROKEN_FILE ) {
|
||||
// Do not repetitivly regenerate metadata on broken file.
|
||||
return self::METADATA_GOOD;
|
||||
|
|
@ -142,7 +142,7 @@ class PNGHandler extends BitmapHandler {
|
|||
* @param File $image
|
||||
* @return string
|
||||
*/
|
||||
function getLongDesc( $image ) {
|
||||
public function getLongDesc( $image ) {
|
||||
global $wgLang;
|
||||
$original = parent::getLongDesc( $image );
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class SvgHandler extends ImageHandler {
|
|||
'title' => 'ObjectName',
|
||||
];
|
||||
|
||||
function isEnabled() {
|
||||
public function isEnabled() {
|
||||
global $wgSVGConverters, $wgSVGConverter;
|
||||
if ( !isset( $wgSVGConverters[$wgSVGConverter] ) ) {
|
||||
wfDebug( "\$wgSVGConverter is invalid, disabling SVG rendering.\n" );
|
||||
|
|
@ -399,7 +399,7 @@ class SvgHandler extends ImageHandler {
|
|||
}
|
||||
}
|
||||
|
||||
function getThumbType( $ext, $mime, $params = null ) {
|
||||
public function getThumbType( $ext, $mime, $params = null ) {
|
||||
return [ 'png', 'image/png' ];
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ class SvgHandler extends ImageHandler {
|
|||
* @param File $file
|
||||
* @return string
|
||||
*/
|
||||
function getLongDesc( $file ) {
|
||||
public function getLongDesc( $file ) {
|
||||
global $wgLang;
|
||||
|
||||
$metadata = $this->unpackMetadata( $file->getMetadata() );
|
||||
|
|
@ -438,7 +438,7 @@ class SvgHandler extends ImageHandler {
|
|||
* @param string $filename
|
||||
* @return string Serialised metadata
|
||||
*/
|
||||
function getMetadata( $file, $filename ) {
|
||||
public function getMetadata( $file, $filename ) {
|
||||
$metadata = [ 'version' => self::SVG_METADATA_VERSION ];
|
||||
try {
|
||||
$metadata += SVGMetadataExtractor::getMetadata( $filename );
|
||||
|
|
@ -469,7 +469,7 @@ class SvgHandler extends ImageHandler {
|
|||
return 'parsed-svg';
|
||||
}
|
||||
|
||||
function isMetadataValid( $image, $metadata ) {
|
||||
public function isMetadataValid( $image, $metadata ) {
|
||||
$meta = $this->unpackMetadata( $metadata );
|
||||
if ( $meta === false ) {
|
||||
return self::METADATA_BAD;
|
||||
|
|
@ -493,7 +493,7 @@ class SvgHandler extends ImageHandler {
|
|||
* @param bool|IContextSource $context Context to use (optional)
|
||||
* @return array|bool
|
||||
*/
|
||||
function formatMetadata( $file, $context = false ) {
|
||||
public function formatMetadata( $file, $context = false ) {
|
||||
$result = [
|
||||
'visible' => [],
|
||||
'collapsed' => []
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class TiffHandler extends ExifBitmapHandler {
|
|||
* @param array|null $params
|
||||
* @return bool
|
||||
*/
|
||||
function getThumbType( $ext, $mime, $params = null ) {
|
||||
public function getThumbType( $ext, $mime, $params = null ) {
|
||||
global $wgTiffThumbnailType;
|
||||
|
||||
return $wgTiffThumbnailType;
|
||||
|
|
@ -76,7 +76,7 @@ class TiffHandler extends ExifBitmapHandler {
|
|||
* @throws MWException
|
||||
* @return string
|
||||
*/
|
||||
function getMetadata( $image, $filename ) {
|
||||
public function getMetadata( $image, $filename ) {
|
||||
global $wgShowEXIF;
|
||||
|
||||
if ( $wgShowEXIF ) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ abstract class TransformationalImageHandler extends ImageHandler {
|
|||
* 'physicalWidth' and 'physicalHeight' indicate the thumbnail dimensions.
|
||||
* @return bool
|
||||
*/
|
||||
function normaliseParams( $image, &$params ) {
|
||||
public function normaliseParams( $image, &$params ) {
|
||||
if ( !parent::normaliseParams( $image, $params ) ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class XCFHandler extends BitmapHandler {
|
|||
* @param array|null $params
|
||||
* @return array
|
||||
*/
|
||||
function getThumbType( $ext, $mime, $params = null ) {
|
||||
public function getThumbType( $ext, $mime, $params = null ) {
|
||||
return [ 'png', 'image/png' ];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
class MockDjVuHandler extends DjVuHandler {
|
||||
function isEnabled() {
|
||||
public function isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue