Writing MIME as written in Wikipedia and some documentation clean up.
Change-Id: I9dfc36d2bf55d72d9374c4075bd6d45eef0415a4
returning false. May also be an array, where the first element is the message
key and the remaining elements are used as parameters to the message.
-'UploadVerifyFile': extra file verification, based on mime type, etc. Preferred
+'UploadVerifyFile': extra file verification, based on MIME type, etc. Preferred
in most cases over UploadVerification.
object $upload: an instance of UploadBase, with all info about the upload
-string $mime: The uploaded file's mime type, as detected by MediaWiki. Handlers
- will typically only apply for specific mime types.
+string $mime: The uploaded file's MIME type, as detected by MediaWiki. Handlers
+ will typically only apply for specific MIME types.
object &$error: output: true if the file is valid. Otherwise, an indexed array
representing the problem with the file, where the first element is the message
key and the remaining elements are used as parameters to the message.
'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl' );
/**
- * Files with these mime types will never be allowed as uploads
+ * Files with these MIME types will never be allowed as uploads
* if $wgVerifyMimeType is enabled.
*/
$wgMimeTypeBlacklist = array(
$wgUploadSizeWarning = false;
/**
- * list of trusted media-types and mime types.
+ * list of trusted media-types and MIME types.
* Use the MEDIATYPE_xxx constants to represent media types.
* This list is used by File::isSafeFile
*
$wgAntivirusRequired = true;
/**
- * Determines if the mime type of uploaded files should be checked
+ * Determines if the MIME type of uploaded files should be checked
*/
$wgVerifyMimeType = true;
/**
- * Sets the mime type definition file to use by MimeMagic.php.
+ * Sets the MIME type definition file to use by MimeMagic.php.
* Set to null, to use built-in defaults only.
* example: $wgMimeTypeFile = '/etc/mime.types';
*/
$wgMimeTypeFile = 'includes/mime.types';
/**
- * Sets the mime type info file to use by MimeMagic.php.
+ * Sets the MIME type info file to use by MimeMagic.php.
* Set to null, to use built-in defaults only.
*/
$wgMimeInfoFile = 'includes/mime.info';
/**
- * Sets an external mime detector program. The command must print only
- * the mime type to standard output.
+ * Sets an external MIME detector program. The command must print only
+ * the MIME type to standard output.
* The name of the file to process will be appended to the command given here.
* If not set or NULL, mime_content_type will be used if available.
*
* @par Example:
* @code
- * #$wgMimeDetectorCommand = "file -bi"; # use external mime detector (Linux)
+ * #$wgMimeDetectorCommand = "file -bi"; # use external MIME detector (Linux)
* @endcode
*/
$wgMimeDetectorCommand = null;
/**
- * Switch for trivial mime detection. Used by thumb.php to disable all fancy
+ * Switch for trivial MIME detection. Used by thumb.php to disable all fancy
* things, because only a few types of images are needed and file extensions
* can be trusted.
*/
$wgTrivialMimeDetection = false;
/**
- * Additional XML types we can allow via mime-detection.
+ * Additional XML types we can allow via MIME-detection.
* array = ( 'rootElement' => 'associatedMimeType' )
*/
$wgXMLMimeTypes = array(
* Normally we wouldn't have to define this in the root "<html>"
* element, but IE needs it there in some circumstances.
*
- * This is ignored if $wgMimeType is set to a non-XML mimetype.
+ * This is ignored if $wgMimeType is set to a non-XML MIME type.
*/
$wgXhtmlNamespaces = array();
*
* There are two important configuration options this class uses:
*
- * $wgMimeType: If this is set to an xml mimetype then output should be
+ * $wgMimeType: If this is set to an xml MIME type then output should be
* valid XHTML5.
* $wgWellFormedXml: If this is set to true, then all output should be
* well-formed XML (quotes on attributes, self-closing tags, etc.).
$isXHTML = self::isXmlMimeType( $wgMimeType );
if ( $isXHTML ) { // XHTML5
- // XML mimetyped markup should have an xml header.
+ // XML MIME-typed markup should have an xml header.
// However a DOCTYPE is not needed.
$ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
}
/**
- * Determines if the given mime type is xml.
+ * Determines if the given MIME type is xml.
*
- * @param string $mimetype MimeType
+ * @param string $mimetype MIME type
* @return bool
*/
public static function isXmlMimeType( $mimetype ) {
# http://www.whatwg.org/html/infrastructure.html#xml-mime-type
# * text/xml
# * application/xml
- # * Any mimetype with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
+ # * Any MIME type with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
return (bool)preg_match( '!^(text|application)/xml$|^.+/.+\+xml$!', $mimetype );
}
<?php
/**
- * Module defining helper functions for detecting and dealing with mime types.
+ * Module defining helper functions for detecting and dealing with MIME types.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
/**
- * Defines a set of well known mime types
+ * Defines a set of well known MIME types
* This is used as a fallback to mime.types files.
- * An extensive list of well known mime types is provided by
+ * An extensive list of well known MIME types is provided by
* the file mime.types in the includes directory.
*
- * This list concatenated with mime.types is used to create a mime <-> ext
- * map. Each line contains a mime type followed by a space separated list of
- * extensions. If multiple extensions for a single mime type exist or if
- * multiple mime types exist for a single extension then in most cases
- * MediaWiki assumes that the first extension following the mime type is the
- * canonical extension, and the first time a mime type appears for a certain
- * extension is considered the canonical mime type.
+ * This list concatenated with mime.types is used to create a MIME <-> ext
+ * map. Each line contains a MIME type followed by a space separated list of
+ * extensions. If multiple extensions for a single MIME type exist or if
+ * multiple MIME types exist for a single extension then in most cases
+ * MediaWiki assumes that the first extension following the MIME type is the
+ * canonical extension, and the first time a MIME type appears for a certain
+ * extension is considered the canonical MIME type.
*
* (Note that appending $wgMimeTypeFile to the end of MM_WELL_KNOWN_MIME_TYPES
* sucks because you can't redefine canonical types. This could be fixed by
);
/**
- * Defines a set of well known mime info entries
+ * Defines a set of well known MIME info entries
* This is used as a fallback to mime.info files.
- * An extensive list of well known mime types is provided by
+ * An extensive list of well known MIME types is provided by
* the file mime.info in the includes directory.
*/
define( 'MM_WELL_KNOWN_MIME_INFO', <<<END_STRING
);
/**
- * Implements functions related to mime types such as detection and mapping to
+ * Implements functions related to MIME types such as detection and mapping to
* file extension.
*
* Instances of this class are stateless, there only needs to be one global instance
*/
class MimeMagic {
/**
- * @var array Mapping of media types to arrays of mime types.
+ * @var array Mapping of media types to arrays of MIME types.
* This is used by findMediaType and getMediaType, respectively
*/
protected $mMediaTypes = null;
- /** @var array Map of mime type aliases
+ /** @var array Map of MIME type aliases
*/
protected $mMimeTypeAliases = null;
- /** @var array Map of mime types to file extensions (as a space separated list)
+ /** @var array Map of MIME types to file extensions (as a space separated list)
*/
protected $mMimeToExt = null;
- /** @var array Map of file extensions types to mime types (as a space separated list)
+ /** @var array Map of file extensions types to MIME types (as a space separated list)
*/
public $mExtToMime = null;
}
/**
- * Returns a list of file extensions for a given mime type as a space
- * separated string or null if the mime type was unrecognized. Resolves
- * mime type aliases.
+ * Returns a list of file extensions for a given MIME type as a space
+ * separated string or null if the MIME type was unrecognized. Resolves
+ * MIME type aliases.
*
* @param string $mime
* @return string|null
return $this->mMimeToExt[$mime];
}
- // Resolve the mime type to the canonical type
+ // Resolve the MIME type to the canonical type
if ( isset( $this->mMimeTypeAliases[$mime] ) ) {
$mime = $this->mMimeTypeAliases[$mime];
if ( isset( $this->mMimeToExt[$mime] ) ) {
}
/**
- * Returns a list of mime types for a given file extension as a space
+ * Returns a list of MIME types for a given file extension as a space
* separated string or null if the extension was unrecognized.
*
* @param string $ext
}
/**
- * Returns a single mime type for a given file extension or null if unknown.
+ * Returns a single MIME type for a given file extension or null if unknown.
* This is always the first type from the list returned by getTypesForExtension($ext).
*
* @param string $ext
}
/**
- * Tests if the extension matches the given mime type. Returns true if a
- * match was found, null if the mime type is unknown, and false if the
- * mime type is known but no matches where found.
+ * Tests if the extension matches the given MIME type. Returns true if a
+ * match was found, null if the MIME type is unknown, and false if the
+ * MIME type is known but no matches where found.
*
* @param string $extension
* @param string $mime
$ext = $this->getExtensionsForType( $mime );
if ( !$ext ) {
- return null; // Unknown mime type
+ return null; // Unknown MIME type
}
$ext = explode( ' ', $ext );
}
/**
- * Returns true if the mime type is known to represent an image format
+ * Returns true if the MIME type is known to represent an image format
* supported by the PHP GD library.
*
* @param string $mime
* invalid uploads; if we can't identify the type we won't
* be able to say if it's invalid.
*
- * @todo Be more accurate when using fancy mime detector plugins;
+ * @todo Be more accurate when using fancy MIME detector plugins;
* right now this is the bare minimum getimagesize() list.
* @param string $extension
* @return bool
}
/**
- * Improves a mime type using the file extension. Some file formats are very generic,
- * so their mime type is not very meaningful. A more useful mime type can be derived
+ * Improves a MIME type using the file extension. Some file formats are very generic,
+ * so their MIME type is not very meaningful. A more useful MIME type can be derived
* by looking at the file extension. Typically, this method would be called on the
* result of guessMimeType().
*
- * @param string $mime The mime type, typically guessed from a file's content.
+ * @param string $mime The MIME type, typically guessed from a file's content.
* @param string $ext The file extension, as taken from the file name
*
- * @return string The mime type
+ * @return string The MIME type
*/
public function improveTypeFromExtension( $mime, $ext ) {
if ( $mime === 'unknown/unknown' ) {
} elseif ( $mime === 'application/x-opc+zip' ) {
if ( $this->isMatchingExtension( $ext, $mime ) ) {
// A known file extension for an OPC file,
- // find the proper mime type for that file extension
+ // find the proper MIME type for that file extension
$mime = $this->guessTypesForExtension( $ext );
} else {
wfDebug( __METHOD__ . ": refusing to guess better type for $mime file, " .
}
/**
- * Mime type detection. This uses detectMimeType to detect the mime type
+ * MIME type detection. This uses detectMimeType to detect the MIME type
* of the file, but applies additional checks to determine some well known
- * file formats that may be missed or misinterpreted by the default mime
+ * file formats that may be missed or misinterpreted by the default MIME
* detection (namely XML based formats like XHTML or SVG, as well as ZIP
* based formats like OPC/ODF files).
*
* @param string $file The file to check
* @param string|bool $ext The file extension, or true (default) to extract it from the filename.
* Set it to false to ignore the extension. DEPRECATED! Set to false, use
- * improveTypeFromExtension($mime, $ext) later to improve mime type.
+ * improveTypeFromExtension($mime, $ext) later to improve MIME type.
*
- * @return string The mime type of $file
+ * @return string The MIME type of $file
*/
public function guessMimeType( $file, $ext = true ) {
if ( $ext ) { // TODO: make $ext default to false. Or better, remove it.
}
/**
- * Guess the mime type from the file contents.
+ * Guess the MIME type from the file contents.
*
* @param string $file
* @param mixed $ext
* @param string|null $tail The tail of the file
* @param string|bool $ext The file extension, or true to extract it from the filename.
* Set it to false (default) to ignore the extension. DEPRECATED! Set to false,
- * use improveTypeFromExtension($mime, $ext) later to improve mime type.
+ * use improveTypeFromExtension($mime, $ext) later to improve MIME type.
*
* @return string
*/
# TODO: remove the block below, as soon as improveTypeFromExtension is used everywhere
if ( $ext !== true && $ext !== false ) {
/** This is the mode used by getPropsFromPath
- * These mime's are stored in the database, where we don't really want
+ * These MIME's are stored in the database, where we don't really want
* x-opc+zip, because we use it only for internal purposes
*/
if ( $this->isMatchingExtension( $ext, $mime ) ) {
}
/**
- * Internal mime type detection. Detection is done using an external
+ * Internal MIME type detection. Detection is done using an external
* program, if $wgMimeDetectorCommand is set. Otherwise, the fileinfo
* extension and mime_content_type are tried (in this order), if they
- * are available. If the detections fails and $ext is not false, the mime
+ * are available. If the detections fails and $ext is not false, the MIME
* type is guessed from the file extension, using guessTypesForExtension.
*
- * If the mime type is still unknown, getimagesize is used to detect the
- * mime type if the file is an image. If no mime type can be determined,
+ * If the MIME type is still unknown, getimagesize is used to detect the
+ * MIME type if the file is an image. If no MIME type can be determined,
* this function returns 'unknown/unknown'.
*
* @param string $file The file to check
* @param string|bool $ext The file extension, or true (default) to extract it from the filename.
* Set it to false to ignore the extension. DEPRECATED! Set to false, use
- * improveTypeFromExtension($mime, $ext) later to improve mime type.
+ * improveTypeFromExtension($mime, $ext) later to improve MIME type.
*
- * @return string The mime type of $file
+ * @return string The MIME type of $file
*/
private function detectMimeType( $file, $ext = true ) {
global $wgMimeDetectorCommand;
# If you may need to load the fileinfo extension at runtime, set
# $wgLoadFileinfoExtension in LocalSettings.php
- $mime_magic_resource = finfo_open( FILEINFO_MIME ); /* return mime type ala mimetype extension */
+ $mime_magic_resource = finfo_open( FILEINFO_MIME ); /* return MIME type ala mimetype extension */
if ( $mime_magic_resource ) {
$m = finfo_file( $mime_magic_resource, $file );
}
/**
- * Determine the media type code for a file, using its mime type, name and
+ * Determine the media type code for a file, using its MIME type, name and
* possibly its contents.
*
- * This function relies on the findMediaType(), mapping extensions and mime
+ * This function relies on the findMediaType(), mapping extensions and MIME
* types to media types.
*
* @todo analyse file if need be
* @todo look at multiple extension, separately and together.
*
* @param string $path Full path to the image file, in case we have to look at the contents
- * (if null, only the mime type is used to determine the media type code).
- * @param string $mime Mime type. If null it will be guessed using guessMimeType.
+ * (if null, only the MIME type is used to determine the media type code).
+ * @param string $mime MIME type. If null it will be guessed using guessMimeType.
*
* @return string A value to be used with the MEDIATYPE_xxx constants.
*/
return MEDIATYPE_UNKNOWN;
}
- // If mime type is unknown, guess it
+ // If MIME type is unknown, guess it
if ( !$mime ) {
$mime = $this->guessMimeType( $path, false );
}
}
}
- // Check for entry for full mime type
+ // Check for entry for full MIME type
if ( $mime ) {
$type = $this->findMediaType( $mime );
if ( $type !== MEDIATYPE_UNKNOWN ) {
}
}
- // Check major mime type
+ // Check major MIME type
if ( $mime ) {
$i = strpos( $mime, '/' );
if ( $i !== false ) {
}
/**
- * Returns a media code matching the given mime type or file extension.
+ * Returns a media code matching the given MIME type or file extension.
* File extensions are represented by a string starting with a dot (.) to
- * distinguish them from mime types.
+ * distinguish them from MIME types.
*
* This function relies on the mapping defined by $this->mMediaTypes
* @access private
*/
function findMediaType( $extMime ) {
if ( strpos( $extMime, '.' ) === 0 ) {
- // If it's an extension, look up the mime types
+ // If it's an extension, look up the MIME types
$m = $this->getTypesForExtension( substr( $extMime, 1 ) );
if ( !$m ) {
return MEDIATYPE_UNKNOWN;
$m = explode( ' ', $m );
} else {
- // Normalize mime type
+ // Normalize MIME type
if ( isset( $this->mMimeTypeAliases[$extMime] ) ) {
$extMime = $this->mMimeTypeAliases[$extMime];
}
}
/**
- * Overriding class returns the mime type that should be sent to the client.
+ * Overriding class returns the MIME type that should be sent to the client.
* This method is not called if getIsHtml() returns true.
* @return string
*/
$ext = self::extensionFromPath( $this->path );
}
- # mime type according to file contents
+ # MIME type according to file contents
$info['file-mime'] = $this->getMimeType();
- # logical mime type
+ # logical MIME type
$info['mime'] = $magic->improveTypeFromExtension( $info['file-mime'], $ext );
list( $info['major_mime'], $info['minor_mime'] ) = File::splitMime( $info['mime'] );
* read a file into a string or several files into a map of path names to strings
* download a file or set of files to a temporary file (on a mounted file system)
* get the SHA1 hash of a file
-* get various properties of a file (stat information, content time, mime information, ...)
+* get various properties of a file (stat information, content time, MIME information, ...)
On directories:
* get a list of files directly under a directory
}
/**
- * Returns the mime type of the file.
+ * Returns the MIME type of the file.
* @return string
*/
public function getMimeType() {
}
/**
- * Returns the mime type of the file.
+ * Returns the MIME type of the file.
* Overridden by LocalFile, UnregisteredLocalFile
* STUB
*
/** @var int Result of the query for the file's history (nextHistoryLine) */
private $historyRes;
- /** @var string Major mime type */
+ /** @var string Major MIME type */
private $major_mime;
- /** @var string Minor mime type */
+ /** @var string Minor MIME type */
private $minor_mime;
/** @var string Upload timestamp */
}
/**
- * Returns the mime type of the file.
+ * Returns the MIME type of the file.
* @return string
*/
function getMimeType() {
/* Protected Static Members */
- /** @var array List of common image files extensions and mime-types */
+ /** @var array List of common image files extensions and MIME-types */
protected static $mimeTypes = array(
'gif' => 'image/gif',
'jpe' => 'image/jpeg',
*/
public static function getMimeType( $file ) {
$realpath = realpath( $file );
- // Try a couple of different ways to get the mime-type of a file, in order of
+ // Try a couple of different ways to get the MIME-type of a file, in order of
// preference
if (
$realpath
&& function_exists( 'finfo_open' )
&& defined( 'FILEINFO_MIME_TYPE' )
) {
- // As of PHP 5.3, this is how you get the mime-type of a file; it uses the Fileinfo
+ // As of PHP 5.3, this is how you get the MIME-type of a file; it uses the Fileinfo
// PECL extension
return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
} elseif ( function_exists( 'mime_content_type' ) ) {
- // Before this was deprecated in PHP 5.3, this was how you got the mime-type of a file
+ // Before this was deprecated in PHP 5.3, this was how you got the MIME-type of a file
return mime_content_type( $file );
} else {
- // Worst-case scenario has happened, use the file extension to infer the mime-type
+ // Worst-case scenario has happened, use the file extension to infer the MIME-type
$ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) );
if ( isset( self::$mimeTypes[$ext] ) ) {
return self::$mimeTypes[$ext];
* @param string $chunk the first 256 bytes of the file
* @param string $proposed the MIME type proposed by the server
*
- * @return Array: map of IE version to detected mime type
+ * @return Array: map of IE version to detected MIME type
*/
public function getRealMimesFromData( $fileName, $chunk, $proposed ) {
$types = $this->getMimesFromData( $fileName, $chunk, $proposed );
* @param string $chunk the first 256 bytes of the file
* @param string $proposed the MIME type proposed by the server
*
- * @return Array: map of IE version to detected mime type
+ * @return Array: map of IE version to detected MIME type
*/
public function getMimesFromData( $fileName, $chunk, $proposed ) {
$types = array();
}
}
- if(!is_null($mime)) // fallback if the mime type is still unknown
+ if(!is_null($mime)) // fallback if the MIME type is still unknown
$url = sprintf('data:%s;base64,%s', $mime, base64_encode(file_get_contents($fullpath)));
}
}
function getThumbType( $ext, $mime, $params = null ) {
$magic = MimeMagic::singleton();
if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) {
- // The extension is not valid for this mime type and we do
- // recognize the mime type
+ // The extension is not valid for this MIME type and we do
+ // recognize the MIME type
$extensions = $magic->getExtensionsForType( $mime );
if ( $extensions ) {
return array( strtok( $extensions, ' ' ), $mime );
}
}
- // The extension is correct (true) or the mime type is unknown to
+ // The extension is correct (true) or the MIME type is unknown to
// MediaWiki (null)
return array( $ext, $mime );
}
'mode' => XMPReader::MODE_SEQ,
'validate' => 'validateDate',
),
- /* Do not extract dc:format, as we've got better ways to determine mimetype */
+ /* Do not extract dc:format, as we've got better ways to determine MIME type */
'identifier' => array(
'map_group' => 'deprecated',
'map_name' => 'Identifier',
-# Mime type info file.
-# the first mime type in each line is the "main" mime type,
+# MIME type info file.
+# the first MIME type in each line is the "main" MIME type,
# the others are aliases for this type
# the media type is given in upper case and square brackets,
# like [BITMAP], and must indicate a media type as defined by
throw new UploadStashFileNotFoundException( "no local path for scaled item" );
}
- // now we should construct a File, so we can get mime and other such info in a standard way
- // n.b. mimetype may be different from original (ogx original -> jpeg thumb)
+ // now we should construct a File, so we can get MIME and other such info in a standard way
+ // n.b. MIME type may be different from original (ogx original -> jpeg thumb)
$thumbFile = new UnregisteredLocalFile( false,
$this->stash->repo, $thumbnailImage->getStoragePath(), false );
if ( !$thumbFile ) {
* Output HTTP response of raw content
* Side effect: writes HTTP response to STDOUT.
* @param string $content Content
- * @param string $contentType Mime type
+ * @param string $contentType MIME type
* @throws SpecialUploadStashTooLargeException
* @return bool
*/
/**
* Output headers for streaming
* @todo Unsure about encoding as binary; if we received from HTTP perhaps
- * we should use that encoding, concatted with semicolon to mimeType as it
+ * we should use that encoding, concatenated with semicolon to `$contentType` as it
* usually is.
* Side effect: preps PHP to write headers to STDOUT.
* @param string $contentType String suitable for content-type header
}
/**
- * Verify the mime type.
+ * Verify the MIME type.
*
- * @note Only checks that it is not an evil mime. The "does it have
- * correct extension given its mime type?" check is in verifyFile.
- * @param string $mime Representing the mime
+ * @note Only checks that it is not an evil MIME. The "does it have
+ * correct extension given its MIME type?" check is in verifyFile.
+ * in `verifyFile()` that MIME type and file extension correlate.
+ * @param string $mime Representing the MIME
* @return mixed True if the file is verified, an array otherwise
*/
protected function verifyMimeType( $mime ) {
return array( 'filetype-badmime', $mime );
}
- # Check IE type
+ # Check what Internet Explorer would detect
$fp = fopen( $this->mTempPath, 'rb' );
$chunk = fread( $fp, 256 );
fclose( $fp );
$this->mFileProps = FSFile::getPropsFromPath( $this->mTempPath, $this->mFinalExtension );
- # check mime type, if desired
+ # check MIME type, if desired
$mime = $this->mFileProps['file-mime'];
$status = $this->verifyMimeType( $mime );
if ( $status !== true ) {
}
/**
- * Checks if the mime type of the uploaded file matches the file extension.
+ * Checks if the MIME type of the uploaded file matches the file extension.
*
- * @param string $mime The mime type of the uploaded file
+ * @param string $mime The MIME type of the uploaded file
* @param string $extension The filename extension that the file is to be served with
* @return bool
*/
* positives in some situations.
*
* @param string $file Pathname to the temporary upload file
- * @param string $mime The mime type of the file
+ * @param string $mime The MIME type of the file
* @param string $extension The extension of the file
* @return bool True if the file contains something looking like embedded scripts
*/
}
/**
- * Find or guess extension -- ensuring that our extension matches our mime type.
+ * Find or guess extension -- ensuring that our extension matches our MIME type.
* Since these files are constructed from php tempnames they may not start off
* with an extension.
* XXX this is somewhat redundant with the checks that ApiUpload.php does with incoming
if ( $n !== false ) {
$extension = $n ? substr( $path, $n + 1 ) : '';
} else {
- // If not, assume that it should be related to the mime type of the original file.
+ // If not, assume that it should be related to the MIME type of the original file.
$magic = MimeMagic::singleton();
$mimeType = $magic->guessMimeType( $path );
$extensions = explode( ' ', MimeMagic::singleton()->getExtensionsForType( $mimeType ) );
--- Add indexes to the mime types in image for use on Special:MIMEsearch,
+-- Add indexes to the MIME types in image for use on Special:MIMEsearch,
-- changes a query like
--
-- SELECT img_name FROM image WHERE img_major_mime = "image" AND img_minor_mime = "svg";
}
}
if ( $mime ) {
- # Use custom handling to serve files with a known mime type
+ # Use custom handling to serve files with a known MIME type
# This way we can serve things like .svg files that the built-in
# PHP webserver doesn't understand.
# ;) Nicely enough we just happen to bundle a mime.types file
$this->addOption(
'mime',
- '(Inefficient!) Only refresh files with this mime type. Can accept wild-card image/*',
+ '(Inefficient!) Only refresh files with this MIME type. Can accept wild-card image/*',
false,
true
);
*
* @param {string|Array} modules Either the name of a module, array of modules,
* or a URL of an external script or style
- * @param {string} [type='text/javascript'] mime-type to use if calling with a URL of an
+ * @param {string} [type='text/javascript'] MIME type to use if calling with a URL of an
* external script or style; acceptable values are "text/css" and
* "text/javascript"; if no type is provided, text/javascript is assumed.
* @param {boolean} [async] Whether to load modules asynchronously.
/**
* @dataProvider providerImproveTypeFromExtension
* @param $ext String File extension (no leading dot)
- * @param $oldMime String Initially detected mime
- * @param $expectedMime String Mime type after taking extension into account
+ * @param $oldMime String Initially detected MIME
+ * @param $expectedMime String MIME type after taking extension into account
*/
function testImproveTypeFromExtension( $ext, $oldMime, $expectedMime ) {
$actualMime = $this->mimeMagic->improveTypeFromExtension( $oldMime, $ext );
*
* @param string $fieldName name this would have in the upload form
* @param string $fileName name to title this
- * @param string $type mime type
+ * @param string $type MIME type
* @param string $filePath path where to find file contents
*
* @throws Exception
/**
* @dataProvider providerMimeFiltering
* @param $par String subpage for special page
- * @param $major String Major mime type we expect to look for
- * @param $minor String Minor mime type we expect to look for
+ * @param $major String Major MIME type we expect to look for
+ * @param $minor String Minor MIME type we expect to look for
*/
function testMimeFiltering( $par, $major, $minor ) {
$this->page->run( $par );
define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
require __DIR__ . '/includes/WebStart.php';
-// Don't use fancy mime detection, just check the file extension for jpg/gif/png
+// Don't use fancy MIME detection, just check the file extension for jpg/gif/png
$wgTrivialMimeDetection = true;
if ( defined( 'THUMB_HANDLER' ) ) {
return $params; // valid thumbnail URL (via extension or config)
}
- // FIXME: Files in the temp zone don't set a mime type, which means
+ // FIXME: Files in the temp zone don't set a MIME type, which means
// they don't have a handler. Which means we can't parse the param
// string. However, not a big issue as what good is a param string
// if you have no handler to make use of the param string and