r45812 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45811‎ | r45812 | r45813 >
Date:21:19, 16 January 2009
Author:demon
Status:ok (Comments)
Tags:
Comment:
(bug 17035) Fail gracefully if php's file_uploads are disabled.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1143,6 +1143,7 @@
11441144 'overwroteimage',
11451145 'uploaddisabled',
11461146 'uploaddisabledtext',
 1147+ 'php-uploaddisabledtext',
11471148 'uploadscripted',
11481149 'uploadcorrupt',
11491150 'uploadvirus',
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -228,6 +228,12 @@
229229 global $wgUser, $wgOut;
230230 global $wgEnableUploads;
231231
 232+ # Check php's file_uploads setting
 233+ if( !wfIniGetBool( 'file_uploads' ) ) {
 234+ $wgOut->showErrorPage( 'uploaddisabled', 'php-uploaddisabledtext', array( $this->mDesiredDestName ) );
 235+ return;
 236+ }
 237+
232238 # Check uploading enabled
233239 if( !$wgEnableUploads ) {
234240 $wgOut->showErrorPage( 'uploaddisabled', 'uploaddisabledtext', array( $this->mDesiredDestName ) );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1834,6 +1834,7 @@
18351835 'uploadedimage' => 'uploaded "[[$1]]"',
18361836 'overwroteimage' => 'uploaded a new version of "[[$1]]"',
18371837 'uploaddisabled' => 'Uploads disabled',
 1838+'php-uploaddisabledtext' => 'PHP file uploads are disabled. Please check the file_uploads setting.',
18381839 'uploaddisabledtext' => 'File uploads are disabled.',
18391840 'uploadscripted' => 'This file contains HTML or script code that may be erroneously interpreted by a web browser.',
18401841 'uploadcorrupt' => 'The file is corrupt or has an incorrect extension.
Index: trunk/phase3/RELEASE-NOTES
@@ -43,6 +43,8 @@
4444 * (bug 17010) maintenance/namespaceDupes.php now add the suffix recursively if
4545 the destination page exists
4646 * Page moves should not be minor edits
 47+* (bug 17035) Special:Upload now fails gracefully if PHP's file_uploads has been
 48+ disabled
4749
4850 == API changes in 1.15 ==
4951 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions

Comments

#Comment by Brion VIBBER (talk | contribs)   23:02, 20 January 2009

woohoo :D

Status & tagging log