Merge "Setting up a way to have uploading by URL, but not on Special:Upload"
authorCatrope <roan.kattouw@gmail.com>
Wed, 29 Aug 2012 19:25:13 +0000 (19:25 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 29 Aug 2012 19:25:13 +0000 (19:25 +0000)
includes/DefaultSettings.php
includes/specials/SpecialUpload.php

index 045eb98..e898edf 100644 (file)
@@ -509,7 +509,7 @@ $wgSharedUploadDBprefix = '';
 $wgCacheSharedUploads = true;
 
 /**
- * Allow for upload to be copied from an URL. Requires Special:Upload?source=web
+ * Allow for upload to be copied from an URL.
  * The timeout for copy uploads is set by $wgHTTPTimeout.
  * You have to assign the user right 'upload_by_url' to a user group, to use this.
  */
@@ -526,6 +526,13 @@ $wgAllowAsyncCopyUploads = false;
  */
 $wgCopyUploadsDomains = array();
 
+/**
+ * Enable copy uploads from Special:Upload. $wgAllowCopyUploads must also be
+ * true. If $wgAllowCopyUploads is true, but this is false, you will only be
+ * able to perform copy uploads from the API or extensions (e.g. UploadWizard).
+ */
+$wgCopyUploadsFromSpecialUpload = false;
+
 /**
  * Max size for uploads, in bytes. If not set to an array, applies to all
  * uploads. If set to an array, per upload type maximums can be set, using the
index 43ea345..ac54faa 100644 (file)
@@ -789,6 +789,8 @@ class UploadForm extends HTMLForm {
         * @return Array: descriptor array
         */
        protected function getSourceSection() {
+               global $wgCopyUploadsFromSpecialUpload;
+
                if ( $this->mSessionKey ) {
                        return array(
                                'SessionKey' => array(
@@ -802,7 +804,9 @@ class UploadForm extends HTMLForm {
                        );
                }
 
-               $canUploadByUrl = UploadFromUrl::isEnabled() && UploadFromUrl::isAllowed( $this->getUser() );
+               $canUploadByUrl = UploadFromUrl::isEnabled()
+                       && UploadFromUrl::isAllowed( $this->getUser() )
+                       && $wgCopyUploadsFromSpecialUpload;
                $radio = $canUploadByUrl;
                $selectedSourceType = strtolower( $this->getRequest()->getText( 'wpSourceType', 'File' ) );