Skip to content

Commit

Permalink
Merge pull request #711 from enwikipedia-acc/oauth-useragent
Browse files Browse the repository at this point in the history
Composer package updates
  • Loading branch information
stwalkerster authored Oct 22, 2021
2 parents 009b476 + bc6f053 commit 9977999
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 63 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ext-curl": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"mediawiki/oauthclient": "^1.1"
"mediawiki/oauthclient": "^1.2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3",
Expand Down
116 changes: 57 additions & 59 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion includes/ApplicationBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ protected function setupHelpers(
$siteConfiguration->getOAuthBaseUrl(),
$siteConfiguration->getOAuthConsumerToken(),
$siteConfiguration->getOAuthConsumerSecret(),
$siteConfiguration->getMediawikiWebServiceEndpoint()
$siteConfiguration->getMediawikiWebServiceEndpoint(),
$siteConfiguration->getUserAgent()
));

$page->setNotificationHelper(new IrcNotificationHelper(
Expand Down
7 changes: 5 additions & 2 deletions includes/Helpers/OAuthProtocolHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ class OAuthProtocolHelper implements Interfaces\IOAuthProtocolHelper
* @param string $consumerKey
* @param string $consumerSecret
* @param string $mediawikiWebServiceEndpoint
* @param string $userAgent
*/
public function __construct(
$oauthEndpoint,
$consumerKey,
$consumerSecret,
$mediawikiWebServiceEndpoint
$mediawikiWebServiceEndpoint,
$userAgent
) {
$this->mediawikiWebServiceEndpoint = $mediawikiWebServiceEndpoint;

$oauthClientConfig = new ClientConfig($oauthEndpoint);
$oauthClientConfig->setUserAgent($userAgent);
$oauthClientConfig->setConsumer(new Consumer($consumerKey, $consumerSecret));

$this->oauthClient = new Client($oauthClientConfig);
Expand Down Expand Up @@ -107,4 +110,4 @@ public function apiCall($apiParams, $accessToken, $accessSecret, $method = 'GET'

return json_decode($data);
}
}
}

0 comments on commit 9977999

Please sign in to comment.