r48924 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48923‎ | r48924 | r48925 >
Date:17:45, 27 March 2009
Author:dale
Status:deferred
Tags:
Comment:
consistent Make upload-by-URL fetch timeout configurable
Modified paths:
  • /branches/new-upload/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/new-upload/phase3/includes/UploadFromUrl.php (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/includes/UploadFromUrl.php
@@ -54,7 +54,7 @@
5555 * Returns true if there was an error, false otherwise
5656 */
5757 private function curlCopy() {
58 - global $wgOut;
 58+ global $wgOut, $wgCopyUploadTimeout;
5959
6060 # Open temporary file
6161 $this->mCurlDestHandle = @fopen( $this->mTempPath, "wb" );
@@ -65,7 +65,7 @@
6666
6767 $ch = curl_init();
6868 curl_setopt( $ch, CURLOPT_HTTP_VERSION, 1.0); # Probably not needed, but apparently can work around some bug
69 - curl_setopt( $ch, CURLOPT_TIMEOUT, 60*60); # 1 hour timeout
 69+ curl_setopt( $ch, CURLOPT_TIMEOUT, $wgCopyUploadTimeout); # 1 hour timeout
7070 curl_setopt( $ch, CURLOPT_LOW_SPEED_LIMIT, 512); # 0.5KB per second minimum transfer speed
7171 curl_setopt( $ch, CURLOPT_URL, $this->mUrl);
7272 curl_setopt( $ch, CURLOPT_WRITEFUNCTION, array( $this, 'uploadCurlCallback' ) );
Index: branches/new-upload/phase3/includes/DefaultSettings.php
@@ -428,6 +428,8 @@
429429 $wgCacheSharedUploads = true;
430430 /** Allow for upload to be copied from an URL. Requires Special:Upload?source=web */
431431 $wgAllowCopyUploads = false;
 432+
 433+$wgCopyUploadTimeout = 30;
432434 /**
433435 * Max size for uploads, in bytes. Currently only works for uploads from URL
434436 * via CURL (see $wgAllowCopyUploads). The only way to impose limits on

Status & tagging log