MarkAHershberger has uploaded a new change for review.

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


Change subject: Disable chunked uploads by default.
......................................................................

Disable chunked uploads by default.

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/60/64860/1

diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21
index 717906a..433d56b 100644
--- a/RELEASE-NOTES-1.21
+++ b/RELEASE-NOTES-1.21
@@ -215,6 +215,8 @@
 * (bug 47202) wikibits: FF2Fixes.css should not be loaded in Firefox 20.
 
 === API changes in 1.21 ===
+* BREAKING CHANGE: Chunked uploads are now disabled by default.  You can 
re-enable
+  them by setting $wgAllowChunkedUploads=true
 * 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 9221784..010f4b5 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 e04c762..ce53f6f 100644
--- a/includes/api/ApiUpload.php
+++ b/includes/api/ApiUpload.php
@@ -358,6 +358,8 @@
                }
 
                if ( $this->mParams['chunk'] ) {
+                       $this->checkChunkedEnabled();
+
                        // Chunk upload
                        $this->mUpload = new UploadFromChunks();
                        if ( isset( $this->mParams['filekey'] ) ) {
@@ -651,6 +653,13 @@
                }
        }
 
+       protected function checkChunkedEnabled() {
+               global $wgAllowChunkedUploads;
+               if ( !$wgAllowChunkedUploads ) {
+                       $this->dieUsage( 'Chunked uploads disabled', 
'chunkeduploaddisabled' );
+               }
+       }
+
        public function mustBePosted() {
                return true;
        }
@@ -807,6 +816,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/64860
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e7fcbc511b8bdaebaa374bf5787039bdc797786
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <mhershber...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to