Index: trunk/extensions/ExternalData/ED_Utils.php |
— | — | @@ -3,10 +3,6 @@ |
4 | 4 | * Utility functions for External Data |
5 | 5 | */ |
6 | 6 | |
7 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
8 | | - die( 'This file is a MediaWiki extension; it is not a valid entry point' ); |
9 | | -} |
10 | | - |
11 | 7 | class EDUtils { |
12 | 8 | // how many times to try an HTTP request |
13 | 9 | private static $http_number_of_tries = 3; |
— | — | @@ -451,14 +447,20 @@ |
452 | 448 | */ |
453 | 449 | static function parseTree( $tree, &$retrieved_values ) { |
454 | 450 | foreach ( $tree as $key => $val ) { |
455 | | - if ( is_array( $val ) ) { |
| 451 | + if ( is_array( $val ) && count( $val ) > 1 ) { |
456 | 452 | self::parseTree( $val, $retrieved_values ); |
457 | 453 | } else { |
| 454 | + // If it's an array with just one element, |
| 455 | + // treat it like a regular value. |
| 456 | + if ( is_array( $val ) ) { |
| 457 | + $val = $val[0]; |
| 458 | + } |
458 | 459 | $key = strtolower( $key ); |
459 | | - if ( array_key_exists( $key, $retrieved_values ) ) |
| 460 | + if ( array_key_exists( $key, $retrieved_values ) ) { |
460 | 461 | $retrieved_values[$key][] = $val; |
461 | | - else |
| 462 | + } else { |
462 | 463 | $retrieved_values[$key] = array( $val ); |
| 464 | + } |
463 | 465 | } |
464 | 466 | } |
465 | 467 | } |
— | — | @@ -492,6 +494,10 @@ |
493 | 495 | if ( $edgAllowSSL ) { |
494 | 496 | // The hardcoded 'CURLOPT_SSL_VERIFYPEER' is |
495 | 497 | // needed for MW < 1.17 |
| 498 | + if ( !defined( 'CURLOPT_SSL_VERIFYPEER' ) ) { |
| 499 | + print 'CURLOPT_SSL_VERIFYPEER is not defined on this system - you must set $edgAllowSSL = "false".'; |
| 500 | + return; |
| 501 | + } |
496 | 502 | return Http::get( $url, 'default', array( CURLOPT_SSL_VERIFYPEER => false, 'sslVerifyCert' => false, 'followRedirects' => false ) ); |
497 | 503 | } else { |
498 | 504 | return Http::get( $url ); |