From b55b1fbb6a8446df2d6127e7ec8828431555334f Mon Sep 17 00:00:00 2001 From: Gilles Dubuc Date: Thu, 2 Apr 2015 11:53:12 +0200 Subject: [PATCH] Better file size limit message display logic Only display upload size limit differentiation message if there are 2 upload methods. Bug: T94727 Change-Id: I23c5a5c5e7a30484c242005db831eec5c8c1f4a7 --- includes/specials/SpecialUpload.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 72d02e0c5a..6f9254bad1 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -885,6 +885,17 @@ class UploadForm extends HTMLForm { ); } + $help = $this->msg( 'upload-maxfilesize', + $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] ) + )->parse(); + + // If the user can also upload by URL, there are 2 different file size limits. + // This extra message helps stress which limit corresponds to what. + if ( $canUploadByUrl ) { + $help .= $this->msg( 'word-separator' )->escaped(); + $help .= $this->msg( 'upload_source_file' )->parse(); + } + $descriptor['UploadFile'] = array( 'class' => 'UploadSourceField', 'section' => 'source', @@ -894,11 +905,7 @@ class UploadForm extends HTMLForm { 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, - 'help' => $this->msg( 'upload-maxfilesize', - $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] ) - )->parse() . - $this->msg( 'word-separator' )->escaped() . - $this->msg( 'upload_source_file' )->escaped(), + 'help' => $help, 'checked' => $selectedSourceType == 'file', ); -- 2.20.1