From: Rob Church Date: Sun, 6 May 2007 13:06:21 +0000 (+0000) Subject: Use the standard HTTP fetch functions when retrieving remote wiki pages through trans... X-Git-Tag: 1.31.0-rc.0~53052 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=40c5aef9b8b6a4e6da96616ac6f7f470b73b568a;p=lhc%2Fweb%2Fwiklou.git Use the standard HTTP fetch functions when retrieving remote wiki pages through transwiki, so we can take advantage of cURL goodies if available --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 367afb3b20..fd1d8a915f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -38,6 +38,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN (cosmetic change, no vulnerabilities existed) * Subtitle success message when unblocking a block ID instead of a pseudo link like [[User:#123|#123]] +* Use the standard HTTP fetch functions when retrieving remote wiki pages + through transwiki, so we can take advantage of cURL goodies if available == Maintenance script changes since 1.10 == diff --git a/includes/SpecialImport.php b/includes/SpecialImport.php index c7b861d0c7..10e734ca7a 100644 --- a/includes/SpecialImport.php +++ b/includes/SpecialImport.php @@ -859,11 +859,20 @@ class ImportStreamSource { function newFromURL( $url ) { wfDebug( __METHOD__ . ": opening $url\n" ); - # fopen-wrappers are normally turned off for security. - ini_set( "allow_url_fopen", true ); - $ret = ImportStreamSource::newFromFile( $url ); - ini_set( "allow_url_fopen", false ); - return $ret; + # 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::get( $url ); + if( $data !== false ) { + $file = tmpfile(); + fwrite( $file, $data ); + fflush( $file ); + fseek( $file, 0 ); + return new ImportStreamSource( $file ); + } else { + return new WikiErrorMsg( 'importcantopen' ); + } } public static function newFromInterwiki( $interwiki, $page, $history=false ) {