r78285 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78284‎ | r78285 | r78286 >
Date:23:19, 12 December 2010
Author:emufarmers
Status:resolved (Comments)
Tags:
Comment:
Follow-up to r77956: instead of making $wgFileExtensions override $wgFileBlacklist, make sure the upload page does not mark blacklisted extensions as "Permitted file types". I've updated the MediaWiki.org pages to explain how to remove items from the blacklist.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadBase.php
@@ -568,10 +568,9 @@
569569 if ( $this->mFinalExtension == '' ) {
570570 $this->mTitleError = self::FILETYPE_MISSING;
571571 return $this->mTitle = null;
572 - } elseif ( ( $this->checkFileExtensionList( $ext, $wgFileBlacklist )
573 - && !$this->checkFileExtensionList( $ext, $wgFileExtensions ) ) ||
574 - ( $wgCheckFileExtensions && $wgStrictFileExtensions &&
575 - !$this->checkFileExtension( $this->mFinalExtension, $wgFileExtensions ) ) ) {
 572+ } elseif ( $this->checkFileExtensionList( $ext, $wgFileBlacklist ) ||
 573+ ( $wgCheckFileExtensions && $wgStrictFileExtensions &&
 574+ !$this->checkFileExtension( $this->mFinalExtension, $wgFileExtensions ) ) ) {
576575 $this->mTitleError = self::FILETYPE_BADTYPE;
577576 return $this->mTitle = null;
578577 }
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -899,6 +899,9 @@
900900 $wgFileExtensions, $wgFileBlacklist;
901901
902902 if( $wgCheckFileExtensions ) {
 903+ //don't show blacklisted types as permitted
 904+ $wgFileExtensions = array_diff ( $wgFileExtensions, $wgFileBlacklist );
 905+
903906 if( $wgStrictFileExtensions ) {
904907 # Everything not permitted is banned
905908 $extensionsList =
Index: trunk/phase3/RELEASE-NOTES
@@ -34,6 +34,7 @@
3535 cannot read the page in question.
3636 * (bug 19006) {{REVISIONUSER}} no longer acts like {{CURRENTUSER}} in some cases
3737 * (bug 16019) $wgArticlePath = "/$1" no longer breaks API edit/watch actions
 38+* (bug 18372) File types blacklisted by $wgFileBlacklist will no longer be shown as "Permitted file types" on the upload form
3839
3940 === API changes in 1.18 ===
4041

Follow-up revisions

RevisionCommit summaryAuthorDate
r79693Follow-up to r78285: remove blacklisted file types from $wgFileExtensions in ...emufarmers00:12, 6 January 2011
r797191.17: MFT r78078, r78285, r78787, r79246, r79358, r79480, r79481, r79491, r79...catrope14:15, 6 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r77956(bug 18372) $wgFileExtensions will now override $wgFileBlacklistemufarmers03:21, 7 December 2010

Comments

#Comment by Catrope (talk | contribs)   20:06, 31 December 2010
+			$wgFileExtensions = array_diff ( $wgFileExtensions, $wgFileBlacklist );

This shouldn't be done at such an arbitrary place in the code. If you need FileExtensions minus FileBlacklist for display purposes, put it in a separate variable. If you need blacklisted extensions to be dropped from FileExtensions, do that in a more logical place (the setup process or something).

Status & tagging log