r94523 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94522‎ | r94523 | r94524 >
Date:15:41, 15 August 2011
Author:reedy
Status:deferred
Tags:
Comment:
From the worksheet based feed, get/save a list of worksheets in the feed
Modified paths:
  • /trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php
@@ -44,7 +44,7 @@
4545 if ( $authToken === null ) {
4646 $this->error( 'No auth token returned. Check your Google Credentials', true );
4747 }
48 - $this->output( 'Authorised. Got an authorisation token from Google' );
 48+ $this->output( "Authorised. Got an authorisation token from Google\n" );
4949
5050 $cookies = $http->getCookieJar();
5151 //var_dump( $cookies );
@@ -62,7 +62,27 @@
6363 //var_dump( $res );
6464 //var_dump( $http->getResponseHeaders() );
6565 $content = $http->getContent();
66 - var_dump( $this->formatXmlString( $content ) );
 66+ //var_dump( $this->formatXmlString( $content ) );
 67+
 68+ $reader = new XMLReader();
 69+ $reader->XML( $content );
 70+
 71+ while ( $reader->read() && $reader->name !== 'entry' );
 72+
 73+ $worksheets = array();
 74+ while ( $reader->name === 'entry' ) {
 75+
 76+ $node = new SimpleXMLElement( $reader->readOuterXML() );
 77+
 78+ $src = (string)$node->content["src"];
 79+ $this->output( 'Worksheet found: ' . $src );
 80+ $worksheets[] = $src;
 81+
 82+ // go to next <entry />
 83+ $reader->next( 'entry' );
 84+ }
 85+
 86+ $this->output( "Finished!\n" );
6787 }
6888
6989 /**

Status & tagging log