MarkAHershberger has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/64482


Change subject: Disable chunked uploads for the 1.21 release.
......................................................................

Disable chunked uploads for the 1.21 release.

Change-Id: I727d973abc3d791b8bfc174c674c35f0432d382c
---
M RELEASE-NOTES-1.21
M includes/DefaultSettings.php
M includes/api/ApiUpload.php
3 files changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/82/64482/1

diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21
index 717906a..7cd4376 100644
--- a/RELEASE-NOTES-1.21
+++ b/RELEASE-NOTES-1.21
@@ -215,6 +215,7 @@
 * (bug 47202) wikibits: FF2Fixes.css should not be loaded in Firefox 20.
 
 === API changes in 1.21 ===
+* Chunked uploads are disabled by default.  They can be enabled with $
 * prop=revisions can now report the contentmodel and contentformat.
   See docs/contenthandler.txt.
 * action=edit and action=parse now support contentmodel and contentformat
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 2cb0a36..45a8b53 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -327,6 +327,13 @@
 $wgEnableAsyncUploads = false;
 
 /**
+ * Allow chunked uploads.  This should only really be needed if you
+ * use the UploadWizard extension or allow huge file uploads.
+ * https://www.mediawiki.org/wiki/API:Upload#Chunked_uploading
+ */
+$wgAllowChunkedUploads = false;
+
+/**
  * These are additional characters that should be replaced with '-' in 
filenames
  */
 $wgIllegalFileChars = ":";
diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php
index 5563087..d6acf37 100644
--- a/includes/api/ApiUpload.php
+++ b/includes/api/ApiUpload.php
@@ -352,6 +352,8 @@
                }
 
                if ( $this->mParams['chunk'] ) {
+                       $this->checkChunkedEnabled();
+
                        // Chunk upload
                        $this->mUpload = new UploadFromChunks();
                        if ( isset( $this->mParams['filekey'] ) ) {
@@ -645,6 +647,13 @@
                }
        }
 
+       protected function checkChunkedEnabled() {
+               global $wgAllowChunkedUploads;
+               if ( !$wgAllowChunkedUploads ) {
+                       $this->dieUsage( 'Chunked uploads disabled', 
'chunkeduploaddisabled' );
+               }
+       }
+
        public function mustBePosted() {
                return true;
        }
@@ -801,6 +810,7 @@
                                array( 'code' => 'publishfailed', 'info' => 
'Publishing of stashed file failed' ),
                                array( 'code' => 'internal-error', 'info' => 
'An internal error occurred' ),
                                array( 'code' => 'asynccopyuploaddisabled', 
'info' => 'Asynchronous copy uploads disabled' ),
+                               array( 'code' => 'chunkeduploaddisabled', 
'info' => 'Chunked uploads disabled' ),
                                array( 'fileexists-forbidden' ),
                                array( 'fileexists-shared-forbidden' ),
                        )

-- 
To view, visit https://gerrit.wikimedia.org/r/64482
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I727d973abc3d791b8bfc174c674c35f0432d382c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to