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

Change subject: Blank the configuration variables in extension.json
......................................................................


Blank the configuration variables in extension.json

Bug: T138275
Change-Id: I09516c6612f7c842c5b7b941d27b661935772081
---
M MailgunHooks.php
M extension.json
2 files changed, 12 insertions(+), 4 deletions(-)

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



diff --git a/MailgunHooks.php b/MailgunHooks.php
index 61ba017..a21cd23 100644
--- a/MailgunHooks.php
+++ b/MailgunHooks.php
@@ -33,14 +33,22 @@
         * @param string $subject
         * @param string $body
         * @return bool
+        * @throws Exception
         */
        public static function onAlternateUserMailer(
                array $headers, array $to, MailAddress $from, $subject, $body
        ) {
                $conf = RequestContext::getMain()->getConfig();
                $client = new \Http\Adapter\Guzzle6\Client();
-               $mailgunTransport = new \Mailgun\Mailgun( $conf->get( 
'MailgunAPIKey' ), $client );
-               $message = $mailgunTransport->BatchMessage( $conf->get( 
'MailgunDomain' ) );
+
+               $mailgunAPIKey = $conf->get( 'MailgunAPIKey' );
+               $mailgunDomain = $conf->get( 'MailgunDomain' );
+               if ( $mailgunAPIKey == "" or $mailgunDomain == "" ) {
+                       throw new MWException( "Please update your 
LocalSettings.php with the correct Mailgun API configurations" );
+               }
+
+               $mailgunTransport = new \Mailgun\Mailgun( $mailgunAPIKey, 
$client );
+               $message = $mailgunTransport->BatchMessage( $mailgunDomain );
 
                $message->setFromAddress( $from );
                $message->setSubject( $subject );
diff --git a/extension.json b/extension.json
index 0c7ace4..7418840 100644
--- a/extension.json
+++ b/extension.json
@@ -23,8 +23,8 @@
        },
        "load_composer_autoloader": true,
        "config": {
-               "MailgunAPIKey": "key-asdfasdfasdf",
-               "MailgunDomain": "example.in"
+               "MailgunAPIKey": "",
+               "MailgunDomain": ""
        },
        "manifest_version": 1
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I09516c6612f7c842c5b7b941d27b661935772081
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
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