[MediaWiki-commits] [Gerrit] Fallback to English help desk - change (mediawiki...UploadWizard)

2016-01-26 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fallback to English help desk
..


Fallback to English help desk

Only when the localised one doesn't exist, no better way to do this
gracefully as far as I know.

Bug: T32049
Change-Id: I565cc4f9480df90e14cad1bed942160c38e1136a
---
M includes/UploadWizardTutorial.php
1 file changed, 7 insertions(+), 0 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/UploadWizardTutorial.php 
b/includes/UploadWizardTutorial.php
index 2f0fe73..a00dae7 100644
--- a/includes/UploadWizardTutorial.php
+++ b/includes/UploadWizardTutorial.php
@@ -114,6 +114,13 @@
$helpDeskHref = $helpDeskUrl;
} else {
$helpDeskTitle = Title::newFromText( $helpDeskUrl );
+   if ( !$helpDeskTitle || !$helpDeskTitle->exists() ) {
+   // Fall back to the wiki's content 
language...if that page
+   // doesn't exist, we can't help.
+   $helpDeskUrl = wfMessage( 
'mwe-upwiz-help-desk-url' )->inContentLanguage()->text();
+   $helpDeskTitle = Title::newFromText( 
$helpDeskUrl );
+   }
+
$helpDeskHref = $helpDeskTitle ? 
$helpDeskTitle->getLocalURL() : '#';
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I565cc4f9480df90e14cad1bed942160c38e1136a
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 
Gerrit-Reviewer: Bartosz Dziewoński 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] Fallback to English help desk - change (mediawiki...UploadWizard)

2015-12-03 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

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

Change subject: Fallback to English help desk
..

Fallback to English help desk

Only when the localised one doesn't exist, no better way to do this
gracefully as far as I know.

Bug: T32049
Change-Id: I565cc4f9480df90e14cad1bed942160c38e1136a
---
M includes/UploadWizardTutorial.php
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/41/256741/1

diff --git a/includes/UploadWizardTutorial.php 
b/includes/UploadWizardTutorial.php
index 2f0fe73..0f4be75 100644
--- a/includes/UploadWizardTutorial.php
+++ b/includes/UploadWizardTutorial.php
@@ -109,6 +109,14 @@
public static function getImageHtml( MediaTransformOutput $thumb, 
$tutorial ) {
$helpDeskUrl = wfMessage( 'mwe-upwiz-help-desk-url' )->text();
 
+   $helpDeskTitle = Title::newFromText( $helpDeskUrl );
+   if ( !$helpDeskTitle->exists() ) {
+   // This sucks, but fall back to the English page in case
+   // the current language doesn't have one.
+   $helpDeskUrl = new Message( 'mwe-upwiz-help-desk-url', 
array(), Language::factory( 'en' ) );
+   $helpDeskUrl = $helpDeskUrl->text();
+   }
+
// Per convention, we may be either using an absolute URL or a 
wiki page title in this UI message
if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', 
$helpDeskUrl ) ) {
$helpDeskHref = $helpDeskUrl;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I565cc4f9480df90e14cad1bed942160c38e1136a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

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