+ /**
+ * Do the upload
+ * Checks are made in SpecialUpload::execute()
+ *
+ * @access private
+ */
+ function processUpload(){
+ global $wgUser, $wgOut, $wgFileExtensions;
+ $details = null;
+ $value = null;
+ $value = $this->internalProcessUpload( $details );
+
+ switch($value) {
+ case self::SUCCESS:
+ $wgOut->redirect( $this->mLocalFile->getTitle()->getFullURL() );
+ return;
+
+ case self::BEFORE_PROCESSING:
+ return false;
+
+ case self::LARGE_FILE_SERVER:
+ $this->mainUploadForm( wfMsgHtml( 'largefileserver' ) );
+ return;
+
+ case self::EMPTY_FILE:
+ $this->mainUploadForm( wfMsgHtml( 'emptyfile' ) );
+ return;
+
+ case self::MIN_LENGHT_PARTNAME:
+ $this->mainUploadForm( wfMsgHtml( 'minlength1' ) );
+ return;
+
+ case self::ILLEGAL_FILENAME:
+ $filtered = $details['filtered'];
+ $this->uploadError( wfMsgWikiHtml( 'illegalfilename', htmlspecialchars( $filtered ) ) );
+ return;
+
+ case self::PROTECTED_PAGE:
+ return $this->uploadError( wfMsgWikiHtml( 'protectedpage' ) );
+
+ case self::OVERWRITE_EXISTING_FILE:
+ $errorText = $details['overwrite'];
+ $overwrite = new WikiError( $wgOut->parse( $errorText ) );
+ return $this->uploadError( $overwrite->toString() );
+
+ case self::FILETYPE_MISSING:
+ return $this->uploadError( wfMsgExt( 'filetype-missing', array ( 'parseinline' ) ) );
+
+ case self::FILETYPE_BADTYPE:
+ $finalExt = $details['finalExt'];
+ return $this->uploadError( wfMsgExt( 'filetype-badtype', array ( 'parseinline' ), htmlspecialchars( $finalExt ), implode ( ', ', $wgFileExtensions ) ) );
+
+ case self::VERIFICATION_ERROR:
+ $veri = $details['veri'];
+ return $this->uploadError( $veri->toString() );
+
+ case self::UPLOAD_VERIFICATION_ERROR:
+ $error = $details['error'];
+ return $this->uploadError( $error );
+
+ case self::UPLOAD_WARNING:
+ $warning = $details['warning'];
+ return $this->uploadWarning( $warning );
+ }
+
+ /* TODO: Each case returns instead of breaking to maintain the highest level of compatibility during branch merging.
+ They should be reviewed and corrected separatelly.
+ */
+ new MWException( __METHOD__ . ": Unknown value `{$value}`" );
+ }