I am trying to find out how to add Office 2007 mime types to Mediawiki.
Thank you!
Sean
On Jan 29, 2008 4:11 PM, Sean Branam sbranam@leadfusion.com wrote:
I am trying to find out how to add Office 2007 mime types to Mediawiki.
Thank you!
Sean
See < http://www.mediawiki.org/wiki/Manual:Mime_type_detection#MIME_type_validatio...
.
See < http://www.mediawiki.org/wiki/Manual:Mime_type_detection#MIME_ type_validation
.
Putting:
application/msword doc xls ppt
works for getting the files into the wiki, but causes the wrong mime types to be sent back when the user accesses the file.
What I've found to work (and please let me know if there is a better way), is to send the correct mime type out depending on the extension:
--- MimeMagic.php.old 2008-01-29 16:15:59.000000000 -0600 +++ MimeMagic.php 2008-01-29 16:15:35.000000000 -0600 @@ -497,6 +497,21 @@
}
+ //BEGIN CUSTOMIZATION + # New excel files have the same magic number as msword files + if ( $mime == "application/msword" ) { + $i = strrpos( $file, '.' ); + $e = strtolower( $i ? substr( $file, $i + 1 ) : '' ); + + if ( $e == "xls" ) { + $mime= "application/vnd.ms-excel"; + } + if ( $e == "ppt" ) { + $mime= "application/vnd.ms-powerpoint"; + } + } + //END CUSTOMIZATION + if ( isset( $this->mMimeTypeAliases[$mime] ) ) { $mime = $this->mMimeTypeAliases[$mime]; }
V/r,
Ryan Lane
Putting:
application/msword doc xls ppt
works for getting the files into the wiki, but causes the wrong mime types to be sent back when the user accesses the file.
I guess I should be more specific when I say this... This is only the case when using img_auth.php, otherwise Apache sends the mime type back out.
V/r,
Ryan Lane
Lane, Ryan wrote:
Putting:
application/msword doc xls ppt
[...]
if ( $e == "xls" ) {
$mime= "application/vnd.ms-excel";
}
if ( $e == "ppt" ) {
$mime= "application/vnd.ms-powerpoint";
Just guessing here, but wouldn't it be possible to put something like:
application/msword doc application/vnd.ms-excel xls application/vnd.ms-powerpoint ppt
and skip the coding?
Mike
Just guessing here, but wouldn't it be possible to put something like:
application/msword doc application/vnd.ms-excel xls application/vnd.ms-powerpoint ppt
and skip the coding?
Mike
No, because then MediaWiki won't let you upload the file because the system sees the ppt and xls files as msword mime type. The real problem is that all of those formats have the same magic number, so you have to do trickery.
This may be different with older version of office, but the newer versions seem to do this.
V/r,
Ryan Lane
On 29/01/2008, Sean Branam sbranam@leadfusion.com wrote:
I am trying to find out how to add Office 2007 mime types to Mediawiki.
Thank you!
Sean
If you asked the question because you want to upload these files, simply edit LocalSettings.php and add the extensions to $wgFileExtensions. E.g. $wgFileExtensions = array('gif','png','jpg','jpeg','svg','xls','doc','ppt');
Note that it usually isn't a good idea to upload e.g. word documents in wiki as you lose a lot of flexibility both in reading and updating documentation. If you have Word documents you want to migrate to wiki, there are decent word to mediawiki conversion tools around to help you. We're using this one: http://www.mediawiki.org/wiki/Extension:Word2MediaWikiPlus
Kind regards,
Herta conversion tools around to help you. We're using this one: http://www.mediawiki.org/wiki/Extension:Word2MediaWikiPlus
On 29/01/2008, Herta Van den Eynde herta.vandeneynde@gmail.com wrote:
Note that it usually isn't a good idea to upload e.g. word documents in wiki as you lose a lot of flexibility both in reading and updating documentation. If you have Word documents you want to migrate to wiki, there are decent word to mediawiki conversion tools around to help you. We're using this one: http://www.mediawiki.org/wiki/Extension:Word2MediaWikiPlus
We upload MS Word and Excel files when they're actually the original form of something and we want to keep it around (like allowing upload of PDFs). This is only on our sysadmin wiki, and we don't have an antivirus in place yet - I really wouldn't enable MS Office documents on a more general wiki without good antivirus in place.
- d.
mediawiki-l@lists.wikimedia.org