Add $wgCopyUploadProxy to be used for copy uploads only.
authorReedy <reedy@wikimedia.org>
Fri, 28 Sep 2012 00:33:48 +0000 (01:33 +0100)
committerReedy <reedy@wikimedia.org>
Fri, 28 Sep 2012 00:33:48 +0000 (01:33 +0100)
Means we don't break stuff on the cluster such as search by setting $wgHTTPProxy

Change-Id: I094b2bfd097e7e5c1c45b6332357d959ed95ac99

includes/DefaultSettings.php
includes/upload/UploadFromUrl.php

index 19670bf..6d67428 100644 (file)
@@ -530,6 +530,12 @@ $wgAllowAsyncCopyUploads = false;
  */
 $wgCopyUploadsDomains = array();
 
+/**
+ * Proxy to use for copy upload requests.
+ * @since 1.20
+ */
+$wgCopyUploadProxy = 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 c11d719..927c3cd 100644 (file)
@@ -207,9 +207,14 @@ class UploadFromUrl extends UploadBase {
                $this->mRemoveTempFile = true;
                $this->mFileSize = 0;
 
-               $req = MWHttpRequest::factory( $this->mUrl, array(
+               $options = array(
                        'followRedirects' => true
-               ) );
+               );
+               global $wgCopyUploadProxy;
+               if ( $wgCopyUploadProxy !== false ) {
+                       $options['proxy'] = $wgCopyUploadProxy;
+               }
+               $req = MWHttpRequest::factory( $this->mUrl, $options );
                $req->setCallback( array( $this, 'saveTempFileChunk' ) );
                $status = $req->execute();