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

Change subject: Mirror messages to php-queue backend
......................................................................


Mirror messages to php-queue backend

Might want to catch potential exceptions.

Bug: T145419
Change-Id: Id80eda1541ab4347c33717b14e66fa4ee9712e90
---
M extension.json
M methods/FundraiserUnsubscribeThankYou.php
2 files changed, 21 insertions(+), 2 deletions(-)

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



diff --git a/extension.json b/extension.json
index 6cf12c9..39d929a 100644
--- a/extension.json
+++ b/extension.json
@@ -51,6 +51,8 @@
                "FundraisingEmailUnsubscribeSilverpopURL": null,
                "FundraisingEmailUnsubscribeLogFacility": 8,
                "FundraisingEmailUnsubscribeLogXmlTransactions": false,
+               "FundraisingEmailUnsubscribeQueueClass": "",
+               "FundraisingEmailUnsubscribeQueueParameters": {},
                "FundraisingEmailUnsubscribeProcesses": {
                        "thankyou": [
                                "FundraiserUnsubscribeThankYou"
diff --git a/methods/FundraiserUnsubscribeThankYou.php 
b/methods/FundraiserUnsubscribeThankYou.php
index 130521e..b8970f7 100644
--- a/methods/FundraiserUnsubscribeThankYou.php
+++ b/methods/FundraiserUnsubscribeThankYou.php
@@ -63,19 +63,36 @@
        }
 
        public function unsubscribe( $requestID, $process, array $params ) {
+               global $wgFundraisingEmailUnsubscribeQueueClass,
+                          $wgFundraisingEmailUnsubscribeQueueParameters;
+
                Logger::pushLabel( 'UnsubThankYou' );
 
                $email = $params['email'];
                $contribId = $params['contribution-id'];
 
+               $message = array(
+                       'process' => $process,
+                       'email' => $email,
+                       'contribution-id' => $contribId
+               );
                // And now we attempt the STOMP transaction
                Logger::log( 'Placing STOMP message in queue for email ' . 
json_encode( $email ) );
                $result = FundraiserUnsubscribeStompAdapter::sendMessage(
-                       array( 'process' => $process, 'email' => $email, 
'contribution-id' => $contribId ),
+                       $message,
                        'unsubscribe',
                        $requestID
                );
-
+               if ( $wgFundraisingEmailUnsubscribeQueueClass ) {
+                       if ( empty( 
$wgFundraisingEmailUnsubscribeQueueParameters['queue'] ) ) {
+                               
$wgFundraisingEmailUnsubscribeQueueParameters['queue'] = 'unsubscribe';
+                       }
+                       $queue = new $wgFundraisingEmailUnsubscribeQueueClass(
+                               $wgFundraisingEmailUnsubscribeQueueParameters
+                       );
+                       // Throws exception if it is unsuccessful
+                       $queue->push( $message );
+               }
                // Clean up and return
                Logger::popLabel();
                return $result;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id80eda1541ab4347c33717b14e66fa4ee9712e90
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/FundraisingEmailUnsubscribe
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com>
Gerrit-Reviewer: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org>
Gerrit-Reviewer: Eileen <emcnaugh...@wikimedia.org>
Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: Katie Horn <kh...@wikimedia.org>
Gerrit-Reviewer: Pcoombe <pcoo...@wikimedia.org>
Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org>
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