jenkins-bot has submitted this change and it was merged.

Change subject: Add extra_param to pass to the ORES service and use precaching
......................................................................


Add extra_param to pass to the ORES service and use precaching

Change-Id: I4be941b08bdff6639a3b852343abc6ef33112921
---
M includes/FetchScoreJob.php
M includes/Hooks.php
M includes/Scoring.php
3 files changed, 9 insertions(+), 4 deletions(-)

Approvals:
  Ladsgroup: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/FetchScoreJob.php b/includes/FetchScoreJob.php
index ff73692..7cfa446 100644
--- a/includes/FetchScoreJob.php
+++ b/includes/FetchScoreJob.php
@@ -18,7 +18,8 @@
        public function run() {
                $logger = LoggerFactory::getInstance( 'ORES' );
                $logger->info( 'Fetching scores for revision ' . json_encode( 
$this->params ) );
-               $scores = Scoring::instance()->getScores( 
$this->params['revid'] );
+               $scores = Scoring::instance()->getScores(
+                       $this->params['revid'], null, 
$this->params['extra_params'] );
                Cache::instance()->storeScores( $scores );
                $logger->debug( 'Stored scores: ' . json_encode( $scores ) );
 
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 60a2ba7..f8c5ff7 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -50,6 +50,7 @@
                        ] );
                        $job = new FetchScoreJob( $rc->getTitle(), [
                                'revid' => $revid,
+                               'extra_params' => [ 'precache' => 'true' ],
                        ] );
                        JobQueueGroup::singleton()->push( $job );
                        $logger->debug( 'Job pushed for {revid}', [
diff --git a/includes/Scoring.php b/includes/Scoring.php
index a7f1c81..09579c8 100644
--- a/includes/Scoring.php
+++ b/includes/Scoring.php
@@ -7,19 +7,22 @@
         * @param integer|array $revisions Single or multiple revisions
         * @param string|array|null $models Single or multiple model names.  If
         * left empty, all configured models are queries.
+        * @param array $params extra params to be passed to ORES endpoint
         * @return array Results in the form returned by ORES
         * @throws \RuntimeException
         */
-       public function getScores( $revisions, $models = null ) {
+       public function getScores( $revisions, $models = null, array 
$extra_params = [] ) {
                if ( !$models ) {
                        global $wgOresModels;
                        $models = array_keys( array_filter( $wgOresModels ) );
                }
 
-               $wireData = Api::request( [
+               $params = [
                        'models' => implode( '|', (array) $models ),
                        'revids' => implode( '|', (array) $revisions ),
-               ] );
+               ];
+
+               $wireData = Api::request( array_merge( $params, $extra_params ) 
);
                return $wireData;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/292163
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4be941b08bdff6639a3b852343abc6ef33112921
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to