From: Chad Horohoe Date: Fri, 16 Jan 2009 21:19:12 +0000 (+0000) Subject: (bug 17035) Fail gracefully if php's file_uploads are disabled. X-Git-Tag: 1.31.0-rc.0~43390 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/fiche.php?a=commitdiff_plain;h=a6944ffe665ffe9ef54ed655b8037780dc6ede40;p=lhc%2Fweb%2Fwiklou.git (bug 17035) Fail gracefully if php's file_uploads are disabled. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c2a79c5eef..3d4db25faf 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -43,6 +43,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 17010) maintenance/namespaceDupes.php now add the suffix recursively if the destination page exists * Page moves should not be minor edits +* (bug 17035) Special:Upload now fails gracefully if PHP's file_uploads has been + disabled == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index adfea71aaf..bfbc290477 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -228,6 +228,12 @@ class UploadForm { global $wgUser, $wgOut; global $wgEnableUploads; + # Check php's file_uploads setting + if( !wfIniGetBool( 'file_uploads' ) ) { + $wgOut->showErrorPage( 'uploaddisabled', 'php-uploaddisabledtext', array( $this->mDesiredDestName ) ); + return; + } + # Check uploading enabled if( !$wgEnableUploads ) { $wgOut->showErrorPage( 'uploaddisabled', 'uploaddisabledtext', array( $this->mDesiredDestName ) ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 66a26bc587..9d0dd1d425 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1834,6 +1834,7 @@ If you still want to upload your file, please go back and use a new name. [[File 'uploadedimage' => 'uploaded "[[$1]]"', 'overwroteimage' => 'uploaded a new version of "[[$1]]"', 'uploaddisabled' => 'Uploads disabled', +'php-uploaddisabledtext' => 'PHP file uploads are disabled. Please check the file_uploads setting.', 'uploaddisabledtext' => 'File uploads are disabled.', 'uploadscripted' => 'This file contains HTML or script code that may be erroneously interpreted by a web browser.', 'uploadcorrupt' => 'The file is corrupt or has an incorrect extension. diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 97cdf2d76f..a476c0119c 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1143,6 +1143,7 @@ $wgMessageStructure = array( 'overwroteimage', 'uploaddisabled', 'uploaddisabledtext', + 'php-uploaddisabledtext', 'uploadscripted', 'uploadcorrupt', 'uploadvirus',