r57174 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57173‎ | r57174 | r57175 >
Date:23:25, 30 September 2009
Author:yaron
Status:deferred
Tags:
Comment:
Added handling for $edgAllowSSL
Modified paths:
  • /trunk/extensions/ExternalData/ED_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ExternalData/ED_Utils.php
@@ -276,7 +276,8 @@
277277
278278 static function fetchURL( $url, $post_vars = array(), $get_fresh=false, $try_count=1 ) {
279279 $dbr = wfGetDB( DB_SLAVE );
280 - global $edgStringReplacements, $edgCacheTable, $edgCacheExpireTime;
 280+ global $edgStringReplacements, $edgCacheTable,
 281+ $edgCacheExpireTime, $edgAllowSSL;
281282
282283 // do any special variable replacements in the URLs, for
283284 // secret API keys and the like
@@ -284,8 +285,13 @@
285286 $url = str_replace( $key, $value, $url );
286287 }
287288
288 - if( !isset( $edgCacheTable ) || is_null( $edgCacheTable ) )
289 - return Http::get( $url );
 289+ if( !isset( $edgCacheTable ) || is_null( $edgCacheTable ) ) {
 290+ if ($edgAllowSSL) {
 291+ return Http::get( $url, 'default', array(CURLOPT_SSL_VERIFYPEER => false) );
 292+ } else {
 293+ return Http::get( $url );
 294+ }
 295+ }
290296
291297 // check the cache (only the first 254 chars of the url)
292298 $row = $dbr->selectRow( $edgCacheTable, '*', array( 'url' => substr($url,0,254) ), 'EDUtils::fetchURL' );
@@ -295,7 +301,11 @@
296302 }
297303
298304 if ( !$row || $get_fresh) {
299 - $page = Http::get( $url );
 305+ if ($edgAllowSSL) {
 306+ $page = Http::get( $url, 'default', array(CURLOPT_SSL_VERIFYPEER => false) );
 307+ } else {
 308+ $page = Http::get( $url );
 309+ }
300310 if ( $page === false ) {
301311 sleep( 1 );
302312 if( $try_count >= self::$http_number_of_tries ){

Status & tagging log