{"id":919,"date":"2012-04-21T01:46:09","date_gmt":"2012-04-21T01:46:09","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=919"},"modified":"2012-04-21T01:46:09","modified_gmt":"2012-04-21T01:46:09","slug":"allow-all-file-uploads-in-mediawiki","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2012\/04\/allow-all-file-uploads-in-mediawiki\/","title":{"rendered":"Allow all file uploads in mediawiki"},"content":{"rendered":"<p>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&#8217;s no extensionless option in mediawiki, you have to hack the sourcecode.<\/p>\n<p>Add the following to LocalSettings.php:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$wgStrictFileExtensions = false;\r\n$wgCheckFileExtensions = false;\r\n<\/pre>\n<p>edit \/etc\/php5\/conf.d\/suhosin.ini and change:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n;suhosin.upload.disallow_elf = on\r\n<\/pre>\n<p>to<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nsuhosin.upload.disallow_elf = off\r\n<\/pre>\n<p>Edit: \/usr\/share\/mediawiki\/includes\/specials\/SpecialUpload.php comment out the following block:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/*\r\n                if ($finalExt == '') {\r\n                        return self::FILETYPE_MISSING;\r\n                } elseif ( $this-&gt;checkFileExtensionList( $ext, $wgFileBlacklist ) ||\r\n                                ($wgCheckFileExtensions &amp;&amp; $wgStrictFileExtensions &amp;&amp;\r\n                                        !$this-&gt;checkFileExtension( $finalExt, $wgFileExtensions ) ) ) {\r\n                        $resultDetails = array( 'finalExt' =&gt; $finalExt );\r\n                        return self::FILETYPE_BADTYPE;\r\n                }\r\n*\/\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;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 = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-919","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-eP","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=919"}],"version-history":[{"count":1,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/919\/revisions"}],"predecessor-version":[{"id":920,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/919\/revisions\/920"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}