Index: trunk/extensions/MetricsReporting/fetchOfflineGoogleSpreadsheet.php |
— | — | @@ -2,15 +2,14 @@ |
3 | 3 | |
4 | 4 | require( "MetricsMaintenance.php" ); |
5 | 5 | |
6 | | -class FetchGoogleSpreadsheet extends MetricsMaintenance { |
| 6 | +class FetchOfflineGoogleSpreadsheet extends MetricsMaintenance { |
7 | 7 | public function __construct() { |
8 | 8 | parent::__construct(); |
9 | 9 | $this->mDescription = "Grabs and does stuff with a Google Documents Spreadsheet"; |
10 | | - $this->addArg( 'spreadsheet', 'URL or something to document' ); |
11 | 10 | } |
12 | 11 | |
13 | 12 | public function execute() { |
14 | | - $url = $this->getArg( 0 ); |
| 13 | + $url = 'https://spreadsheets.google.com/feeds/worksheets/0Au8PHt8_RuNedDJZU0V0NDNJT3JIWlVyVzd3WmFZb1E/private/full'; |
15 | 14 | |
16 | 15 | // Headers |
17 | 16 | $http = MWHttpRequest::factory( 'https://www.google.com/accounts/ClientLogin', |
— | — | @@ -27,7 +26,7 @@ |
28 | 27 | ); |
29 | 28 | $http->setHeader( 'User-Agent', self::getUserAgent() ); |
30 | 29 | |
31 | | - $res = $http->execute(); |
| 30 | + $http->execute(); |
32 | 31 | if ( $http->getStatus() == 403 ) { |
33 | 32 | $this->error( '403', true ); |
34 | 33 | } |
— | — | @@ -93,10 +92,10 @@ |
94 | 93 | $this->output( 'Spreadsheet tab title: ' . $xml->title . "\n" ); |
95 | 94 | $this->output( "\n" ); |
96 | 95 | |
97 | | - if ( $xml->title != 'Deployments' ) { |
| 96 | + if ( $xml->title != 'For Report Card' ) { |
98 | 97 | continue; |
99 | 98 | } |
100 | | - //continue; |
| 99 | + |
101 | 100 | $sheetData = array(); |
102 | 101 | // foreach "tab"/worksheet |
103 | 102 | foreach( $xml->entry as $entry ) { |
— | — | @@ -148,7 +147,7 @@ |
149 | 148 | * @param $cookies CookieJar |
150 | 149 | * @return MWHttpRequest |
151 | 150 | */ |
152 | | - function buildAuthedRequest( $url, $token, $cookies = null ) { |
| 151 | + function buildAuthedRequest( $url, $token = null, $cookies = null ) { |
153 | 152 | $http = MWHttpRequest::factory( $url, array( |
154 | 153 | 'method' => 'GET', |
155 | 154 | ) |
— | — | @@ -158,7 +157,9 @@ |
159 | 158 | $http->setCookieJar( $cookies ); |
160 | 159 | } |
161 | 160 | $http->setHeader( 'GData-Version', '3.0' ); |
162 | | - $http->setHeader( 'Authorization', "GoogleLogin auth=\"{$token}\"" ); |
| 161 | + if ( $token !== null ) { |
| 162 | + $http->setHeader( 'Authorization', "GoogleLogin auth=\"{$token}\"" ); |
| 163 | + } |
163 | 164 | return $http; |
164 | 165 | } |
165 | 166 | |
— | — | @@ -170,5 +171,5 @@ |
171 | 172 | } |
172 | 173 | } |
173 | 174 | |
174 | | -$maintClass = "FetchGoogleSpreadsheet"; |
| 175 | +$maintClass = "FetchOfflineGoogleSpreadsheet"; |
175 | 176 | require_once( DO_MAINTENANCE ); |