Skip to content

Commit

Permalink
Accomodate both formatversion=2 and old-style API results (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaldari authored and addshore committed Apr 11, 2017
1 parent 48f7454 commit 94a091c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/MediawikiApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,12 @@ private function getUserAgent() {
private function logWarnings( $result ) {
if( is_array( $result ) && array_key_exists( 'warnings', $result ) ) {
foreach( $result['warnings'] as $module => $warningData ) {
$this->logger->log( LogLevel::WARNING, $module . ': ' . $warningData['*'], array( 'data' => $warningData ) );
// Accomodate both formatversion=2 and old-style API results
if( isset( $warningData['*'] ) ) {
$this->logger->log( LogLevel::WARNING, $module . ': ' . $warningData['*'], array( 'data' => $warningData ) );
} else {
$this->logger->log( LogLevel::WARNING, $module . ': ' . $warningData['warnings'], array( 'data' => $warningData ) );
}
}
}
}
Expand Down

0 comments on commit 94a091c

Please sign in to comment.