Unify the spelling of MIME in documentation
authorrillke <rainerrillke@hotmail.com>
Thu, 24 Jul 2014 14:04:48 +0000 (16:04 +0200)
committerrillke <rillke@wikipedia.de>
Thu, 7 Aug 2014 21:38:45 +0000 (23:38 +0200)
Writing MIME as written in Wikipedia and some documentation clean up.

Change-Id: I9dfc36d2bf55d72d9374c4075bd6d45eef0415a4

27 files changed:
docs/hooks.txt
includes/DefaultSettings.php
includes/Html.php
includes/MimeMagic.php
includes/api/ApiFormatBase.php
includes/filebackend/FSFile.php
includes/filebackend/README
includes/filerepo/file/ArchivedFile.php
includes/filerepo/file/File.php
includes/filerepo/file/LocalFile.php
includes/libs/CSSMin.php
includes/libs/IEContentAnalyzer.php
includes/libs/lessc.inc.php
includes/media/MediaHandler.php
includes/media/XMPInfo.php
includes/mime.info
includes/specials/SpecialUploadStash.php
includes/upload/UploadBase.php
includes/upload/UploadStash.php
maintenance/archives/patch-mimesearch-indexes.sql
maintenance/dev/includes/router.php
maintenance/refreshImageMetadata.php
resources/src/mediawiki/mediawiki.js
tests/phpunit/includes/MimeMagicTest.php
tests/phpunit/includes/api/ApiTestCaseUpload.php
tests/phpunit/includes/specials/SpecialMIMESearchTest.php
thumb.php

index 25f5ad8..becaf40 100644 (file)
@@ -2734,11 +2734,11 @@ string &$error: output: message key for message to show if upload canceled by
   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.
index cbcf456..94476c5 100644 (file)
@@ -758,7 +758,7 @@ $wgFileBlacklist = array(
        '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(
@@ -810,7 +810,7 @@ $wgDisableUploadScriptChecks = false;
 $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
  *
@@ -1133,45 +1133,45 @@ $wgAntivirusSetup = array(
 $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(
@@ -2926,7 +2926,7 @@ $wgWellFormedXml = true;
  * 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();
 
index ce439cb..46bee95 100644 (file)
@@ -36,7 +36,7 @@
  *
  * 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.).
@@ -872,7 +872,7 @@ class Html {
                $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";
 
@@ -904,16 +904,16 @@ class Html {
        }
 
        /**
-        * 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 );
        }
 
index b4d3ab1..8f0a2af 100644 (file)
@@ -1,6 +1,6 @@
 <?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
@@ -86,9 +86,9 @@ END_STRING
 );
 
 /**
- * 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
@@ -135,7 +135,7 @@ 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
@@ -143,20 +143,20 @@ END_STRING
  */
 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;
 
@@ -378,9 +378,9 @@ class MimeMagic {
        }
 
        /**
-        * 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
@@ -393,7 +393,7 @@ class MimeMagic {
                        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] ) ) {
@@ -405,7 +405,7 @@ class MimeMagic {
        }
 
        /**
-        * 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
@@ -419,7 +419,7 @@ class MimeMagic {
        }
 
        /**
-        * 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
@@ -439,9 +439,9 @@ class MimeMagic {
        }
 
        /**
-        * 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
@@ -451,7 +451,7 @@ class MimeMagic {
                $ext = $this->getExtensionsForType( $mime );
 
                if ( !$ext ) {
-                       return null; // Unknown mime type
+                       return null; // Unknown MIME type
                }
 
                $ext = explode( ' ', $ext );
@@ -461,7 +461,7 @@ class MimeMagic {
        }
 
        /**
-        * 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
@@ -490,7 +490,7 @@ class MimeMagic {
         * 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
@@ -515,15 +515,15 @@ class MimeMagic {
        }
 
        /**
-        * 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' ) {
@@ -538,7 +538,7 @@ class MimeMagic {
                } 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, " .
@@ -565,18 +565,18 @@ class MimeMagic {
        }
 
        /**
-        * 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.
@@ -600,7 +600,7 @@ class MimeMagic {
        }
 
        /**
-        * Guess the mime type from the file contents.
+        * Guess the MIME type from the file contents.
         *
         * @param string $file
         * @param mixed $ext
@@ -804,7 +804,7 @@ class MimeMagic {
         * @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
         */
@@ -847,7 +847,7 @@ class MimeMagic {
                        # 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 ) ) {
@@ -896,22 +896,22 @@ class MimeMagic {
        }
 
        /**
-        * 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;
@@ -938,7 +938,7 @@ class MimeMagic {
                        # 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 );
@@ -1003,18 +1003,18 @@ class MimeMagic {
        }
 
        /**
-        * 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.
         */
@@ -1023,7 +1023,7 @@ class MimeMagic {
                        return MEDIATYPE_UNKNOWN;
                }
 
-               // If mime type is unknown, guess it
+               // If MIME type is unknown, guess it
                if ( !$mime ) {
                        $mime = $this->guessMimeType( $path, false );
                }
@@ -1056,7 +1056,7 @@ class MimeMagic {
                        }
                }
 
-               // Check for entry for full mime type
+               // Check for entry for full MIME type
                if ( $mime ) {
                        $type = $this->findMediaType( $mime );
                        if ( $type !== MEDIATYPE_UNKNOWN ) {
@@ -1076,7 +1076,7 @@ class MimeMagic {
                        }
                }
 
-               // Check major mime type
+               // Check major MIME type
                if ( $mime ) {
                        $i = strpos( $mime, '/' );
                        if ( $i !== false ) {
@@ -1096,9 +1096,9 @@ class MimeMagic {
        }
 
        /**
-        * 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
@@ -1107,7 +1107,7 @@ class MimeMagic {
         */
        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;
@@ -1115,7 +1115,7 @@ class MimeMagic {
 
                        $m = explode( ' ', $m );
                } else {
-                       // Normalize mime type
+                       // Normalize MIME type
                        if ( isset( $this->mMimeTypeAliases[$extMime] ) ) {
                                $extMime = $this->mMimeTypeAliases[$extMime];
                        }
index 5d20005..3a0ed46 100644 (file)
@@ -52,7 +52,7 @@ abstract class ApiFormatBase extends ApiBase {
        }
 
        /**
-        * 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
         */
index 47bacb5..1659c62 100644 (file)
@@ -118,9 +118,9 @@ class FSFile {
                                $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'] );
index 569f337..c06f6fc 100644 (file)
@@ -51,7 +51,7 @@ On files:
 * 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
index 735bf8a..a71acde 100644 (file)
@@ -383,7 +383,7 @@ class ArchivedFile {
        }
 
        /**
-        * Returns the mime type of the file.
+        * Returns the MIME type of the file.
         * @return string
         */
        public function getMimeType() {
index c6da1f1..a61002a 100644 (file)
@@ -679,7 +679,7 @@ abstract class File {
        }
 
        /**
-        * Returns the mime type of the file.
+        * Returns the MIME type of the file.
         * Overridden by LocalFile, UnregisteredLocalFile
         * STUB
         *
index 1eff1df..3ba47ff 100644 (file)
@@ -91,10 +91,10 @@ class LocalFile extends File {
        /** @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 */
@@ -784,7 +784,7 @@ class LocalFile extends File {
        }
 
        /**
-        * Returns the mime type of the file.
+        * Returns the MIME type of the file.
         * @return string
         */
        function getMimeType() {
index 4885ae6..4e2ca83 100644 (file)
@@ -44,7 +44,7 @@ class CSSMin {
 
        /* 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',
@@ -135,7 +135,7 @@ class CSSMin {
         */
        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
@@ -143,14 +143,14 @@ class CSSMin {
                        && 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];
index a80f6d9..c31a352 100644 (file)
@@ -333,7 +333,7 @@ class IEContentAnalyzer {
         * @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 );
@@ -371,7 +371,7 @@ class IEContentAnalyzer {
         * @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();
index 37723d5..61ed771 100644 (file)
@@ -1036,7 +1036,7 @@ class lessc {
                                        }
                                }
 
-                               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)));
                        }
                }
index e8f8360..969bb72 100644 (file)
@@ -313,15 +313,15 @@ abstract class MediaHandler {
        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 );
        }
index 3700556..7e47ec1 100644 (file)
@@ -726,7 +726,7 @@ class XMPInfo {
                                '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',
index 7a4de3b..b86d7d7 100644 (file)
@@ -1,5 +1,5 @@
-# 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
index b5b4176..ddb435d 100644 (file)
@@ -197,8 +197,8 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                        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 ) {
@@ -292,7 +292,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
         * 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
         */
@@ -310,7 +310,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
        /**
         * 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
index 6a6b358..4d74a2d 100644 (file)
@@ -377,11 +377,12 @@ abstract class UploadBase {
        }
 
        /**
-        * 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 ) {
@@ -396,7 +397,7 @@ abstract class UploadBase {
                                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 );
@@ -487,7 +488,7 @@ abstract class UploadBase {
 
                $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 ) {
@@ -995,9 +996,9 @@ abstract class UploadBase {
        }
 
        /**
-        * 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
         */
@@ -1050,7 +1051,7 @@ abstract class UploadBase {
         * 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
         */
index 23a7a3a..7d80b44 100644 (file)
@@ -443,7 +443,7 @@ class UploadStash {
        }
 
        /**
-        * 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
@@ -460,7 +460,7 @@ class UploadStash {
                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 ) );
index bd348c4..8d9426e 100644 (file)
@@ -1,4 +1,4 @@
--- 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";
index 246d6fc..0a65e31 100644 (file)
@@ -80,7 +80,7 @@ if ( !$mime ) {
        }
 }
 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
index 8cb23fd..831118c 100644 (file)
@@ -70,7 +70,7 @@ class RefreshImageMetadata extends Maintenance {
 
                $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
                );
index 380e4e6..d50fe48 100644 (file)
                                 *
                                 * @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.
index 2937790..19746a9 100644 (file)
@@ -12,8 +12,8 @@ class MimeMagicTest extends MediaWikiTestCase {
        /**
         * @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 );
index 40407dc..837becc 100644 (file)
@@ -98,7 +98,7 @@ abstract class ApiTestCaseUpload extends ApiTestCase {
         *
         * @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
index e7bb35c..aca77be 100644 (file)
@@ -17,8 +17,8 @@ class SpecialMIMESearchTest extends MediaWikiTestCase {
        /**
         * @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 );
index d53c10c..efaa65b 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -24,7 +24,7 @@
 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' ) ) {
@@ -573,7 +573,7 @@ function wfExtractThumbParams( $file, $params ) {
                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