Allow all file uploads in mediawiki
I wanted to allow /all/ file uploads on a mediawiki installation (debian squeeze). This included files with no extension. This was harder than I thought, as there’s no extensionless option in mediawiki, you have to hack the sourcecode.
Add the following to LocalSettings.php:
$wgStrictFileExtensions = false; $wgCheckFileExtensions = false;
edit /etc/php5/conf.d/suhosin.ini and change:
;suhosin.upload.disallow_elf = on
to
suhosin.upload.disallow_elf = off
Edit: /usr/share/mediawiki/includes/specials/SpecialUpload.php comment out the following block:
/* if ($finalExt == '') { return self::FILETYPE_MISSING; } elseif ( $this->checkFileExtensionList( $ext, $wgFileBlacklist ) || ($wgCheckFileExtensions && $wgStrictFileExtensions && !$this->checkFileExtension( $finalExt, $wgFileExtensions ) ) ) { $resultDetails = array( 'finalExt' => $finalExt ); return self::FILETYPE_BADTYPE; } */