Merge "Documentation: Remove paragraph about not creating a 2nd WebRequest"
[lhc/web/wiklou.git] / includes / specials / SpecialUpload.php
index 7b98a34..b4470f5 100644 (file)
@@ -405,8 +405,14 @@ class SpecialUpload extends SpecialPage {
 
                $form = $this->getUploadForm( $warningHtml, $sessionKey, /* $hideIgnoreWarning */ true );
                $form->setSubmitText( $this->msg( 'upload-tryagain' )->text() );
-               $form->addButton( 'wpUploadIgnoreWarning', $this->msg( 'ignorewarning' )->text() );
-               $form->addButton( 'wpCancelUpload', $this->msg( 'reuploaddesc' )->text() );
+               $form->addButton( array(
+                       'name' => 'wpUploadIgnoreWarning',
+                       'value' => $this->msg( 'ignorewarning' )->text()
+               ) );
+               $form->addButton( array(
+                       'name' => 'wpCancelUpload',
+                       'value' => $this->msg( 'reuploaddesc' )->text()
+               ) );
 
                $this->showUploadForm( $form );
 
@@ -475,6 +481,14 @@ class SpecialUpload extends SpecialPage {
                        }
                }
 
+               // This is as late as we can throttle, after expected issues have been handled
+               if ( UploadBase::isThrottled( $this->getUser() ) ) {
+                       $this->showRecoverableUploadError(
+                               $this->msg( 'actionthrottledtext' )->escaped()
+                       );
+                       return;
+               }
+
                // Get the page text if this is not a reupload
                if ( !$this->mForReUpload ) {
                        $pageText = self::getInitialPageText( $this->mComment, $this->mLicense,
@@ -882,15 +896,10 @@ class UploadForm extends HTMLForm {
                        );
                }
 
-               $this->mMaxUploadSize['file'] = UploadBase::getMaxUploadSize( 'file' );
-               # Limit to upload_max_filesize unless we are running under HipHop and
-               # that setting doesn't exist
-               if ( !wfIsHHVM() ) {
-                       $this->mMaxUploadSize['file'] = min( $this->mMaxUploadSize['file'],
-                               wfShorthandToInteger( ini_get( 'upload_max_filesize' ) ),
-                               wfShorthandToInteger( ini_get( 'post_max_size' ) )
-                       );
-               }
+               $this->mMaxUploadSize['file'] = min(
+                       UploadBase::getMaxUploadSize( 'file' ),
+                       UploadBase::getMaxPhpUploadSize()
+               );
 
                $help = $this->msg( 'upload-maxfilesize',
                                $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] )