Merge "Remove unused 'XMPGetInfo' and 'XMPGetResults' hooks"
[lhc/web/wiklou.git] / includes / specials / SpecialUpload.php
index 72d02e0..1618527 100644 (file)
@@ -160,7 +160,7 @@ class SpecialUpload extends SpecialPage {
                        throw new ErrorPageError( 'uploaddisabled', 'uploaddisabledtext' );
                }
 
-               $this->getOutput()->addHelpLink( 'Help:Managing files' );
+               $this->addHelpLink( 'Help:Managing files' );
 
                # Check permissions
                $user = $this->getUser();
@@ -787,6 +787,10 @@ class UploadForm extends HTMLForm {
        protected $mMaxUploadSize = array();
 
        public function __construct( array $options = array(), IContextSource $context = null ) {
+               if ( $context instanceof IContextSource ) {
+                       $this->setContext( $context );
+               }
+
                $this->mWatch = !empty( $options['watch'] );
                $this->mForReUpload = !empty( $options['forreupload'] );
                $this->mSessionKey = isset( $options['sessionkey'] ) ? $options['sessionkey'] : '';
@@ -814,7 +818,7 @@ class UploadForm extends HTMLForm {
                # Add a link to edit MediaWik:Licenses
                if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
                        $licensesLink = Linker::link(
-                               Title::makeTitle( NS_MEDIAWIKI, 'Licenses' ),
+                               $this->msg( 'licenses' )->inContentLanguage()->getTitle(),
                                $this->msg( 'licenses-edit' )->escaped(),
                                array(),
                                array( 'action' => 'edit' )
@@ -885,6 +889,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 +909,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',
                );