r94748 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94747‎ | r94748 | r94749 >
Date:12:35, 17 August 2011
Author:reedy
Status:deferred
Tags:
Comment:
Remove some debugging statements

Fix user agents to be properly sent as User-Agents
Modified paths:
  • /trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php
@@ -25,15 +25,14 @@
2626 )
2727 )
2828 );
 29+ $http->setHeader( 'User-Agent', self::getUserAgent() );
2930
3031 $res = $http->execute();
3132 if ( $http->getStatus() == 403 ) {
3233 $this->error( '403', true );
3334 }
34 - //var_dump( $res );
35 - //var_dump( $http->getResponseHeaders() );
 35+
3636 $content = $http->getContent();
37 - //var_dump( $content );
3837
3938 $authToken = null;
4039 $pos = strpos( $content, 'Auth' );
@@ -62,7 +61,8 @@
6362
6463 $node = new SimpleXMLElement( $reader->readOuterXML() );
6564
66 - $src = (string)$node->content["src"];
 65+ //$src = (string)$node->content["src"];
 66+ $src = $node->content->attributes()->src;
6767 $this->output( 'Worksheet found: ' . $src );
6868 $worksheets[] = $src;
6969
@@ -103,9 +103,9 @@
104104 function buildAuthedRequest( $url, $token, $cookies = null ) {
105105 $http = MWHttpRequest::factory( $url, array(
106106 'method' => 'GET',
107 - 'source' => self::getUserAgent(),
108107 )
109108 );
 109+ $http->setHeader( 'User-Agent', self::getUserAgent() );
110110 if ( $cookies !== null ) {
111111 $http->setCookieJar( $cookies );
112112 }

Status & tagging log