r53675 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53674‎ | r53675 | r53676 >
Date:14:24, 23 July 2009
Author:jojo
Status:deferred
Tags:
Comment:
fix: Http::userAgent() not available for older MediaWikis
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.body.php
@@ -1027,7 +1027,12 @@
10281028 curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy);
10291029 $userAgent = wfGetAgent();
10301030 if ( !$userAgent ) $userAgent = "Unknown user agent";
1031 - curl_setopt( $c, CURLOPT_USERAGENT, $userAgent . " (via " . Http::userAgent() . ", Collection/$wgCollectionVersion)" );
 1031+ $userAgent .= " (via ";
 1032+ if ( method_exists( Http, 'userAgent' ) ) {
 1033+ $userAgent .= Http::userAgent() . ', ';
 1034+ }
 1035+ $userAgent .= "Collection/$wgCollectionVersion)"
 1036+ curl_setopt( $c, CURLOPT_USERAGENT, $userAgent);
10321037 curl_setopt( $c, CURLOPT_POST, true );
10331038 curl_setopt( $c, CURLOPT_POSTFIELDS, $postFields );
10341039 curl_setopt( $c, CURLOPT_HTTPHEADER, array( 'Expect:' ) );

Status & tagging log