Awight has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/380893 )
Change subject: [WIP] Support new thresholds API ...................................................................... [WIP] Support new thresholds API TODO: Need to preserve old API compatibility and provide a way to switch between them. This patch is currently a hard cutover. Bug: T175053 Change-Id: I683027d43f7dcee1646cab6df70b208476b62bfe --- M extension.json M includes/Api.php M includes/Stats.php 3 files changed, 7 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES refs/changes/93/380893/1 diff --git a/extension.json b/extension.json index 043724a..f2dfc3e 100644 --- a/extension.json +++ b/extension.json @@ -127,7 +127,7 @@ "config": { "OresExtensionStatus": "on", "OresUiEnabled": true, - "OresBaseUrl": "https://ores.wikimedia.org/", + "OresBaseUrl": "https://ores.wikimedia.org/v3/", "OresExcludeBots": true, "OresModels": { "damaging": true, diff --git a/includes/Api.php b/includes/Api.php index daf74aa..605d2df 100644 --- a/includes/Api.php +++ b/includes/Api.php @@ -35,10 +35,9 @@ } /** - * @param string|null $model Name of the model to query * @return string Base URL plus your wiki's `scores` API path. */ - public function getUrl( $model = null ) { + protected function getUrl() { global $wgOresBaseUrl, $wgOresWikiId; if ( $wgOresWikiId ) { @@ -47,9 +46,6 @@ $wikiId = wfWikiID(); } $url = "{$wgOresBaseUrl}scores/{$wikiId}/"; - if ( $model ) { - $url .= "{$model}/"; - } return $url; } @@ -57,14 +53,13 @@ * Make an ORES API request and return the decoded result. * * @param array $params optional GET parameters - * @param string|null $model Name of the model to query * @return array Decoded response * */ - public function request( $params = [], $model = null ) { + public function request( $params = [] ) { $logger = LoggerFactory::getInstance( 'ORES' ); - $url = $this->getUrl( $model ); + $url = $this->getUrl(); $params['format'] = 'json'; $url = wfAppendQuery( $url, $params ); $logger->debug( "Requesting: {$url}" ); diff --git a/includes/Stats.php b/includes/Stats.php index f3f3bae..05ca7c2 100644 --- a/includes/Stats.php +++ b/includes/Stats.php @@ -75,9 +75,9 @@ } private function fetchStatsFromApi( $model ) { - $data = $this->api->request( [ 'model_info' => 'test_stats' ], $model ); - if ( isset( $data[ 'test_stats' ] ) ) { - return $data[ 'test_stats' ]; + $data = $this->api->request( [ 'models' => $model, 'model_info' => 'statistics' ] ); + if ( isset( $data[ 'statistics' ] ) ) { + return $data[ 'statistics' ]; } } -- To view, visit https://gerrit.wikimedia.org/r/380893 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I683027d43f7dcee1646cab6df70b208476b62bfe Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ORES Gerrit-Branch: master Gerrit-Owner: Awight <awi...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits