Page MenuHomePhabricator

Check PHP file_uploads settings in Special:Upload
Closed, ResolvedPublic

Description

It seems we don't actually confirm that file uploads are enabled in PHP... It would be wise for us to check this and tell the poor user he has to fix it in a nice error message. :)


Version: unspecified
Severity: enhancement
URL: http://www.mediawiki.org/wiki/Manual:Configuring_file_uploads#Make_sure_uploads_are_enabled_in_PHP

Details

Reference
bz17035

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:25 PM
bzimport set Reference to bz17035.
bzimport added a subscriber: Unknown Object (MLST).

Right now in execute(), we check if $wgEnableUploads is true, then we output the 'uploaddisabled' message if not:

if( !$wgEnableUploads ) {

To the end users, there's no difference in _why_ it is disabled, so I would think the generic disabled message could be used here. A simple change to:

if( !$wgEnableUploads || !wfIniGetBool( 'file_uploads' ) ) {

should do it?

There's a big fat huge difference to the admin who's trying to figure out why uploads don't work even though he enabled them on the wiki.

Right, but error messages aren't intended for the sysop, they're for the end users. What about throwing a wfDebug() call in there, saying "Uploads are disabled: Check that you've set $wgEnableUploads to true and that PHP's file_uploads is enabled" or some variant.

Reopening, dunno how I marked this as fixed....

A clear error message is appropriate here so the admin will have a clue where to look.

You're the boss :) I'll whip up a patch later today and commit if no one beats me to it. Should be simple enough to do the check right before we've checked $wgEnableUploads then. No point in checking our setting if PHP doesn't allow it at all.

Ahh, that's so much better than just mysteriously failing. :D Thanks!