From: rlot Date: Mon, 2 Jan 2017 19:00:53 +0000 (+0100) Subject: Added $wgHTTPImportTimeout setting X-Git-Tag: 1.31.0-rc.0~4424^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=0480391371b915b93f8ccd98f9122cdc166454f9;p=lhc%2Fweb%2Fwiklou.git Added $wgHTTPImportTimeout setting Bug: T17000 Change-Id: Ic97ae4faec173c32af38df4554831dca7068226b --- diff --git a/RELEASE-NOTES-1.29 b/RELEASE-NOTES-1.29 index 14b569282c..9fc0cbef5f 100644 --- a/RELEASE-NOTES-1.29 +++ b/RELEASE-NOTES-1.29 @@ -35,6 +35,8 @@ production. exceptions, largely so the API can handle them more sensibly. * Blocks created automatically by MediaWiki, such as for configured proxies or dnsbls, are now indicated as such and use a new i18n message when displayed. +* Added new $wgHTTPImportTimeout setting. Sets timeout for + downloading the XML dump during a transwiki import in seconds. === External library changes in 1.29 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 327448019f..449e1c2ae5 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -8055,6 +8055,12 @@ $wgShellLocale = 'en_US.utf8'; */ $wgHTTPTimeout = 25; +/** + * Timeout for HTTP requests done internally for transwiki imports, in seconds. + * @since 1.29 + */ +$wgHTTPImportTimeout = 25; + /** * Timeout for Asynchronous (background) HTTP requests, in seconds. */ diff --git a/includes/import/ImportStreamSource.php b/includes/import/ImportStreamSource.php index e2e8dd52a4..0c12ebb60f 100644 --- a/includes/import/ImportStreamSource.php +++ b/includes/import/ImportStreamSource.php @@ -104,12 +104,21 @@ class ImportStreamSource implements ImportSource { * @return Status */ static function newFromURL( $url, $method = 'GET' ) { + global $wgHTTPImportTimeout; wfDebug( __METHOD__ . ": opening $url\n" ); # Use the standard HTTP fetch function; it times out # quicker and sorts out user-agent problems which might # otherwise prevent importing from large sites, such # as the Wikimedia cluster, etc. - $data = Http::request( $method, $url, [ 'followRedirects' => true ], __METHOD__ ); + $data = Http::request( + $method, + $url, + [ + 'followRedirects' => true, + 'timeout' => $wgHTTPImportTimeout + ], + __METHOD__ + ); if ( $data !== false ) { $file = tmpfile(); fwrite( $file, $data );