[MediaWiki-commits] [Gerrit] Fix internal API error when suggestion requested for empty l... - change (mediawiki...ContentTranslation)

2015-09-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fix internal API error when suggestion requested for empty 
language pair
..


Fix internal API error when suggestion requested for empty language pair

Bug: T113019
Change-Id: I4c0b0a9e64ea0b621525065af47bd6d6ccf6c2ab
---
M includes/Translation.php
1 file changed, 4 insertions(+), 1 deletion(-)

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



diff --git a/includes/Translation.php b/includes/Translation.php
index 43ef7d6..41be9ae 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -89,8 +89,11 @@
 * @return Translation|Translation[]|null Translation
 */
public static function find( $sourceLanguage, $targetLanguage, $titles 
) {
-   $dbr = Database::getConnection( DB_SLAVE );
+   if ( $titles === null || empty( $titles ) ) {
+   return null;
+   }
 
+   $dbr = Database::getConnection( DB_SLAVE );
$values = array(
'translation_source_language' => $sourceLanguage,
'translation_target_language' => $targetLanguage,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4c0b0a9e64ea0b621525065af47bd6d6ccf6c2ab
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 
Gerrit-Reviewer: Amire80 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] Fix internal API error when suggestion requested for empty l... - change (mediawiki...ContentTranslation)

2015-09-17 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix internal API error when suggestion requested for empty 
language pair
..

Fix internal API error when suggestion requested for empty language pair

Bug: T113019

Change-Id: I4c0b0a9e64ea0b621525065af47bd6d6ccf6c2ab
---
M includes/Translation.php
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/includes/Translation.php b/includes/Translation.php
index 43ef7d6..41be9ae 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -89,8 +89,11 @@
 * @return Translation|Translation[]|null Translation
 */
public static function find( $sourceLanguage, $targetLanguage, $titles 
) {
-   $dbr = Database::getConnection( DB_SLAVE );
+   if ( $titles === null || empty( $titles ) ) {
+   return null;
+   }
 
+   $dbr = Database::getConnection( DB_SLAVE );
$values = array(
'translation_source_language' => $sourceLanguage,
'translation_target_language' => $targetLanguage,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c0b0a9e64ea0b621525065af47bd6d6ccf6c2ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

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