[Mediawiki-l] Handling MIME detection for .docx and friends

Ray Van Dolson rvandolson at esri.com
Wed Jun 22 02:41:36 UTC 2011


Running MediaWiki 1.16 on a RHEL5.x server (PHP 5.1.x.) and am trying
to find the "best" way to handle .docx and other compressed file
formats.

I can of course use $wgVerifyMimeType = false, but I'd rather find a
way to handle this differently.

Is this something that might be handled better if I updated to PHP 5.3
(RHEL5 provides a supported version)?  If it relies on the MIME magic
files from the "file" utility still, I'm guessing it still won't
work...

Debug logs show the following:

MimeMagic::__construct: loading mime types from /srv/syswiki.esri.com/wiki/includes/mime.types
MimeMagic::__construct: loading mime info from /srv/syswiki.esri.com/wiki/includes/mime.info
MimeMagic::doGuessMimeType: ZIP header present at end of /tmp/phpESAce0
MimeMagic::detectZipType: /^mimetype(application\/vnd\.oasis\.opendocument\.(?:chart-template|chart|formula-template|formula|graphics-template|graphics|image-template|image|presentation-template|presentation|spreadsheet-template|spreadsheet|text-template|text-master|text-web|text))/
MimeMagic::detectZipType: unable to identify type of ZIP archive
MimeMagic::guessMimeType: final mime type of /tmp/phpESAce0: application/zip
MediaHandler::getHandler: no handler found for application/zip.
File::getPropsFromPath: /tmp/phpESAce0 loaded, 177153 bytes, application/zip.
MacBinary::loadHeader: header bytes 0 and 74 not null
MimeMagic::doGuessMimeType: ZIP header present at end of /tmp/phpESAce0
MimeMagic::detectZipType: /^mimetype(application\/vnd\.oasis\.opendocument\.(?:chart-template|chart|formula-template|formula|graphics-template|graphics|image-template|image|presentation-template|presentation|spreadsheet-template|spreadsheet|text-template|text-master|text-web|text))/
MimeMagic::detectZipType: unable to identify type of ZIP archive
MimeMagic::guessMimeType: final mime type of /tmp/phpESAce0: application/zip

It's somewhat odd that FileInfo isn't being used (I have the extension
installed, showing up in phpInfo() and also $wgLoadFileinfoExtension =
true is set).

Any thoughts or ideas would be appreciated.

Thanks,
Ray



More information about the MediaWiki-l mailing list