Index: trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php |
— | — | @@ -58,7 +58,6 @@ |
59 | 59 | |
60 | 60 | $worksheets = array(); |
61 | 61 | while ( $reader->name === 'entry' ) { |
62 | | - |
63 | 62 | $node = new SimpleXMLElement( $reader->readOuterXML() ); |
64 | 63 | |
65 | 64 | // Worksheet based feed |
— | — | @@ -93,9 +92,13 @@ |
94 | 93 | |
95 | 94 | $this->output( 'Spreadsheet tab title: ' . $xml->title . "\n" ); |
96 | 95 | $this->output( "\n" ); |
97 | | - |
| 96 | + var_dump( $xml->title ); |
| 97 | + if ( $xml->title != 'Deployments' ) { |
| 98 | + continue; |
| 99 | + } |
| 100 | + //continue; |
98 | 101 | $sheetData = array(); |
99 | | - // foreach "tab" |
| 102 | + // foreach "tab"/worksheet |
100 | 103 | foreach( $xml->entry as $entry ) { |
101 | 104 | $namespaces = $entry->getNameSpaces( true ); |
102 | 105 | $gsx = $entry->children( $namespaces['gsx'] ); |
— | — | @@ -108,7 +111,8 @@ |
109 | 112 | } |
110 | 113 | } |
111 | 114 | $this->output( "\n" ); |
112 | | - var_dump( $sheetData ); |
| 115 | + $this->getDeploymentFigures( $sheetData ); |
| 116 | + // var_dump( $sheetData ); |
113 | 117 | $this->output( "\n" ); |
114 | 118 | } |
115 | 119 | |
— | — | @@ -116,6 +120,21 @@ |
117 | 121 | } |
118 | 122 | |
119 | 123 | /** |
| 124 | + * @param $data array |
| 125 | + */ |
| 126 | + function getDeploymentFigures( $data ) { |
| 127 | + $count = count( $data["name"] ); |
| 128 | + |
| 129 | + for( $i = 0; $i < ( $count - 1 ); $i++ ) { |
| 130 | + $data['date'][] = ''; // TODO: The date needs to come from... somewhere? |
| 131 | + } |
| 132 | + |
| 133 | + $db = $this->getDb(); |
| 134 | + |
| 135 | + $db->update( 'offline', $data, __METHOD__, array( 'IGNORE' ) ); |
| 136 | + } |
| 137 | + |
| 138 | + /** |
120 | 139 | * Pretty print xml string |
121 | 140 | * |
122 | 141 | * @param $xml string |