Working With MediaWiki

Read Online Working With MediaWiki by Yaron Koren - Free Book Online Page A

Book: Working With MediaWiki by Yaron Koren Read Free Book Online
Authors: Yaron Koren
Ads: Link
file system in question — this page holds more information:
https://www.mediawiki.org/wiki/Manual:Configuring_file_uploads
    Uploading also needs to be enabled in MediaWiki itself — make sure that you have the following line in LocalSettings.php:
$wgEnableUploads = true;
    By default, every logged-in user is allowed to upload files, but unregistered users aren’t. This can be changed in LocalSettings.php, via the ’upload’ permission. (There’s also a second relevant permission type, ’reupload’, for uploading files that already exist on the wiki and thus overwriting their contents.) To prevent regular users from uploading, for instance, you could add the following to LocalSettings.php:
$wgGroupPermissions['user']['upload'] = false;
$wgGroupPermissions['sysop']['upload'] = true;
    And it may be that you’re allowed to upload files in general, but the specific file you have can’t be uploaded. That could be for two reasons: the file’s size, or its file type.
    Every wiki has a limit on the allowed size of uploaded files, which is set by a combination of four PHP and MediaWiki settings. Essentially, the smallest of these dictates what is allowed to go through, so you may need to change all four to increase the allowed limit on file sizes. There are two PHP settings: “post_max_size” and “upload_max_filesize”, both of which would need to be changed in php.ini. The two MediaWiki variables are $wgUploadSizeWarning and $wgMaxUploadSize — both represent a number of bytes. $wgUploadSizeWarning sets only what file size results in a warning to the user, so it doesn’t actually affect which files go through and which don’t — but it should be made consistent with what the actual limits are. So, to change the allowed file size to 30 megabytes, you would change the following in php.ini:
post_max_size = 30M
upload_max_filesize = 30M
    ...and add the following to LocalSettings.php:
$wgUploadSizeWarning = 30 * 1024 * 1024;
$wgMaxUploadSize = 30 * 1024 * 1024;
File type restrictions
    As for file types — only a limited set is allowed by default, because certain file types, likeMicrosoft Office documents (Word, Excel and the rest) can contain viruses, which unsuspecting users can end up installing on their systems if they download the file. The default set of file extensions allowed is very short: only “png”, “gif”, “jpg” and “jpeg” (with the last two both representing JPG files).
    What if someone tries to upload a .doc file simply by renaming the file’s extension to, say, “.gif”? Thankfully, MediaWiki guards against that by looking at the file’s internal file type, which the web server determines — the allowed set of file suffixes is really just shorthand for the allowed set of file types.
    To add to or change the allowed set of file types, use the “$wgFileExtensions” variable in LocalSettings.php. The most common addition is allowing PDF files — to do that, you would add the following line:
$wgFileExtensions[] = 'pdf';
Extensions for uploading
    A MediaWiki extension, UploadWizard, provides a nicer approach to uploading than the standard one, by guiding users on a step-by-step process that explains all the different options, like the copyright license used. It was developed for use on Wikimedia Commons (the wiki that holds the uploaded files for Wikipedia and other Wikimedia projects), but it can also be used on standard wikis; though some of the wording is unfortunately Wikimedia-specific, and can’t easily be customized away. You can read more about the extension here:
https://www.mediawiki.org/wiki/Extension:UploadWizard
    There’s another extension, MultiUpload, that lets users upload more than one file at the same time; which can be useful when there’s a large set of images to be added. At the moment, this extension is somewhat unmaintained, and may have problems depending on your MediaWiki version, but when it works it’s quite

Similar Books

Southland

Nina Revoyr

REAPER'S KISS

Jaxson Kidman

The Night People

Edward D. Hoch

Black Knight in Red Square

Stuart M. Kaminsky

Strike Back

Chris Ryan

Autumn Calling

T. Lynne Tolles

The Wicked Girls

Alex Marwood