Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/251015

Change subject: Fix: ApiQueryContentTranslation does not respect from and to 
params
......................................................................

Fix: ApiQueryContentTranslation does not respect from and to params

Bug: T117649
Change-Id: Ie8b4bf5f105fa664df482e9097e39e763e379bbf
---
M api/ApiQueryContentTranslation.php
M includes/Translator.php
2 files changed, 14 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/15/251015/1

diff --git a/api/ApiQueryContentTranslation.php 
b/api/ApiQueryContentTranslation.php
index 7e437ab..9ab7f22 100644
--- a/api/ApiQueryContentTranslation.php
+++ b/api/ApiQueryContentTranslation.php
@@ -67,7 +67,9 @@
                $translations = $translator->getAllTranslations(
                        $params['limit'],
                        $params['offset'],
-                       $params['type']
+                       $params['type'],
+                       $params['from'],
+                       $params['to']
                );
 
                // We will have extra continue in case the last batch is 
exactly the size of the limit
diff --git a/includes/Translator.php b/includes/Translator.php
index f085221..52a9d35 100644
--- a/includes/Translator.php
+++ b/includes/Translator.php
@@ -65,12 +65,16 @@
        /**
         * @param int $limit How many results to return
         * @param string [$offset] Offset condition (timestamp)
+        * @param string $from
+        * @param string $to
         * @return Translation[]
         */
        public function getAllTranslations(
                $limit,
                $offset = null,
-               $type = null
+               $type = null,
+               $from = null,
+               $to = null
        ) {
                // Note: there is no index on translation_last_updated_timestamp
                $dbr = Database::getConnection( DB_SLAVE );
@@ -85,6 +89,12 @@
                if ( $type !== null ) {
                        $conds['translation_status'] = $type;
                }
+               if ( $from !== null ) {
+                       $conds['translation_source_language'] = $from;
+               }
+               if ( $to !== null ) {
+                       $conds['translation_target_language'] = $to;
+               }
                if ( $offset !== null ) {
                        $ts = $dbr->addQuotes( $dbr->timestamp( $offset ) );
                        $conds[] = "translation_last_updated_timestamp < $ts";

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8b4bf5f105fa664df482e9097e39e763e379bbf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to