Page MenuHomePhabricator

$wgMimeTypeFile and $wgMimeInfoFile documentation issues
Open, LowPublic

Description

I noticed in DefaultSettings, that they were still pointing at includes, not includes/libs/mime, so I've fixed that in https://gerrit.wikimedia.org/r/#/c/348215/

However, I believe the documentation on them is wrong (code copied from the original pre 348215)

/**
 * 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.
 * Set to null, to use built-in defaults only.
 */
$wgMimeInfoFile = 'includes/mime.info';

Both mention setting to "null" to use built-in defaults only. What built in defaults? Built in defaults of what?

I see in ServiceWiring that we have remapping for the wrong defaults, which is of limited use after the patch, but does serve for anyone copying those into LocalSettings and them being the wrong location

		if ( $params['infoFile'] === 'includes/mime.info' ) {
			$params['infoFile'] = __DIR__ . "/libs/mime/mime.info";
		}

		if ( $params['typeFile'] === 'includes/mime.types' ) {
			$params['typeFile'] = __DIR__ . "/libs/mime/mime.types";
		}

But I don't see any handling of them === null...

Is that where MimeAnalyzer::$wellKnownTypes and MimeAnalyzer::$wellKnownInfo are used? And if the $wg above are null, only those are used?