r90369 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90368‎ | r90369 | r90370 >
Date:21:27, 18 June 2011
Author:mgrabovsky
Status:ok (Comments)
Tags:
Comment:
(bug 29325) Setting $wgStrictFileExtensions to false gives incorrect warning

Also use Language::commaList
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -99,6 +99,7 @@
100100 * The class JpegOrTiffHandler was renamed ExifBitmapHandler.
101101 * (bug 29443) Special:Undelete should use JavaScript to invert all checkboxes
102102 without reloading the page
 103+* (bug 29325) Setting $wgStrictFileExtensions to false gives incorrect warning
103104
104105 === API changes in 1.19 ===
105106 * BREAKING CHANGE: action=watch now requires POST and token.
Index: trunk/phase3/includes/upload/UploadBase.php
@@ -509,6 +509,8 @@
510510 * @return Array of warnings
511511 */
512512 public function checkWarnings() {
 513+ global $wgLang;
 514+
513515 $warnings = array();
514516
515517 $localFile = $this->getLocalFile();
@@ -529,7 +531,8 @@
530532 global $wgCheckFileExtensions, $wgFileExtensions;
531533 if ( $wgCheckFileExtensions ) {
532534 if ( !$this->checkFileExtension( $this->mFinalExtension, $wgFileExtensions ) ) {
533 - $warnings['filetype-unwanted-type'] = $this->mFinalExtension;
 535+ $warnings['filetype-unwanted-type'] = array( $this->mFinalExtension,
 536+ $wgLang->commaList( $wgFileExtensions ) );
534537 }
535538 }
536539
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -567,7 +567,7 @@
568568 * @param $details Array: result of UploadBase::verifyUpload
569569 */
570570 protected function processVerificationError( $details ) {
571 - global $wgFileExtensions;
 571+ global $wgFileExtensions, $wgLang;
572572
573573 switch( $details['status'] ) {
574574
@@ -597,13 +597,12 @@
598598 break;
599599 case UploadBase::FILETYPE_BADTYPE:
600600 $msg = wfMessage( 'filetype-banned-type' );
601 - $sep = wfMsg( 'comma-separator' );
602601 if ( isset( $details['blacklistedExt'] ) ) {
603 - $msg->params( implode( $sep, $details['blacklistedExt'] ) );
 602+ $msg->params( $wgLang->commaList( $details['blacklistedExt'] ) );
604603 } else {
605604 $msg->params( $details['finalExt'] );
606605 }
607 - $msg->params( implode( $sep, $wgFileExtensions ),
 606+ $msg->params( $wgLang->commaList( $wgFileExtensions ),
608607 count( $wgFileExtensions ) );
609608
610609 // Add PLURAL support for the first parameter. This results

Follow-up revisions

RevisionCommit summaryAuthorDate
r90582Follow-up r90369: Add third parameter to filetype-unwanted-type (for PLURAL)...mgrabovsky13:35, 22 June 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   22:30, 21 June 2011
$warnings['filetype-unwanted-type'] = array( $this->mFinalExtension, $wgLang->commaList( $wgFileExtensions ) );

You should add count( $wgFileExtensions ) as a third item to the array, right?
#Comment by Matěj Grabovský (talk | contribs)   13:30, 22 June 2011

Oh, of course. Thank you.

Status & tagging log