38 if ( $version < 1 || $version >= 2 ) {
44 if ( !is_array( $metadata ) ) {
47 if ( !isset( $metadata[
'MEDIAWIKI_EXIF_VERSION'] ) || $metadata[
'MEDIAWIKI_EXIF_VERSION'] != 2 ) {
53 if ( isset( $metadata[
'Software'] )
54 && is_array( $metadata[
'Software'] )
55 && is_array( $metadata[
'Software'][0] )
56 && isset( $metadata[
'Software'][0][0] )
57 && isset( $metadata[
'Software'][0][1] )
59 $metadata[
'Software'] = $metadata[
'Software'][0][0] .
' (Version '
60 . $metadata[
'Software'][0][1] .
')';
66 if ( isset( $metadata[
'Contact'] ) ) {
67 $metadata[
'Contact'] =
69 $metadata[
'Contact'] );
72 foreach ( $metadata
as &$val ) {
73 if ( is_array( $val ) ) {
74 $val = $formatter->flattenArrayReal( $val,
'ul', $avoidHtml );
77 $metadata[
'MEDIAWIKI_EXIF_VERSION'] = 1;
90 # Metadata disabled and so an empty field is expected
93 if ( $metadata === self::OLD_BROKEN_FILE ) {
94 # Old special value indicating that there is no Exif data in the file.
95 # or that there was an error well extracting the metadata.
96 wfDebug( __METHOD__ .
": back-compat version\n" );
100 if ( $metadata === self::BROKEN_FILE ) {
103 MediaWiki\suppressWarnings();
105 MediaWiki\restoreWarnings();
106 if ( !isset( $exif[
'MEDIAWIKI_EXIF_VERSION'] )
109 if ( isset( $exif[
'MEDIAWIKI_EXIF_VERSION'] )
110 && $exif[
'MEDIAWIKI_EXIF_VERSION'] == 1
113 wfDebug( __METHOD__ .
": back-compat version\n" );
117 # Wrong (non-compatible) version
118 wfDebug( __METHOD__ .
": wrong version\n" );
133 if ( count( $meta ) === 0 ) {
142 if ( $metadata === self::OLD_BROKEN_FILE
143 || $metadata === self::BROKEN_FILE
155 unset( $exif[
'MEDIAWIKI_EXIF_VERSION'] );
184 if ( $rotation == 90 || $rotation == 270 ) {
210 $data = $file->getMetadata();
227 MediaWiki\suppressWarnings();
229 MediaWiki\restoreWarnings();
230 if ( isset( $data[
'Orientation'] ) ) {
232 switch ( $data[
'Orientation'] ) {
262 self::SRGB_ICC_PROFILE_NAME,
263 realpath( __DIR__ ) .
'/tinyrgb.icc'
280 public function swapICCProfile( $filepath, $oldProfileString, $profileFilepath ) {
296 if (
$retval !== 0 || strcasecmp( trim(
$output ), $oldProfileString ) !== 0 ) {
302 '-overwrite_original',
303 '-icc_profile<=' . $profileFilepath,
unserialize( $serialized)
$wgUseTinyRGBForJPGThumbnails
When this variable is true and JPGs use the sRGB ICC profile, swaps it for the more lightweight (and ...
$wgExiftool
Path to exiftool binary.
$wgShowEXIF
Show Exif data, on by default if available.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfEscapeShellArg()
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell,...
wfShellExecWithStderr( $cmd, &$retval=null, $environ=[], $limits=[])
Execute a shell command, returning both stdout and stderr.
Generic handler for bitmap images.
Stuff specific to JPEG and (built-in) TIFF handler.
swapICCProfile( $filepath, $oldProfileString, $profileFilepath)
Swaps an embedded ICC profile for another, if found.
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
const SRGB_ICC_PROFILE_NAME
isMetadataValid( $image, $metadata)
getCommonMetaArray(File $file)
Get an array of standard (FormatMetadata type) metadata values.
convertMetadataVersion( $metadata, $version=1)
Convert metadata version.
getRotation( $file)
On supporting image formats, try to read out the low-level orientation of the file and return the ang...
getRotationForExif( $data)
Given a chunk of serialized Exif metadata, return the orientation as degrees of rotation.
transformImageMagick( $image, $params)
Transform an image using ImageMagick.
getImageSize( $image, $path)
Wrapper for base classes ImageHandler::getImageSize() that checks for rotation reported from metadata...
formatMetadata( $image, $context=false)
Implements some public methods and some protected utility functions which are required by multiple ch...
getMetadata()
Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB.
when a variable name is used in a it is silently declared as a new local masking the global
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object & $output
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account incomplete not yet checked for validity & $retval
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check $image
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php