Reedy has uploaded a new change for review.

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

Change subject: Update output of email headers to include both keys and value
......................................................................

Update output of email headers to include both keys and value

Change-Id: I80b05236ef0bc45701a3ad42edbf6449e364054d
---
M includes/BounceHandlerActions.php
1 file changed, 18 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/64/253164/1

diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index 0b4f7d1..defa56e 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -142,7 +142,7 @@
                                $this->notifyGlobalUser( $bounceUserId, 
$originalEmail );
                                wfDebugLog( 'BounceHandler',
                                        "Un-subscribed global user 
$originalEmail for exceeding Bounce Limit 
$this->bounceRecordLimit.\nHeaders:\n" .
-                                               implode( "\n", $emailHeaders )
+                                               $this->formatHeaders( 
$emailHeaders )
                                );
                                
RequestContext::getMain()->getStats()->increment( 'bouncehandler.unsub.global' 
);
                        }
@@ -153,11 +153,27 @@
                        $this->createEchoNotification( $bounceUserId, 
$originalEmail );
                        wfDebugLog( 'BounceHandler',
                                "Un-subscribed $originalEmail for exceeding 
Bounce limit $this->bounceRecordLimit.\nHeaders:\n" .
-                                               implode( "\n", $emailHeaders )
+                                       $this->formatHeaders( $emailHeaders )
                        );
                        RequestContext::getMain()->getStats()->increment( 
'bouncehandler.unsub.local' );
                }
+       }
 
+       /**
+        * Turns a keyed array into "Key: Value" newline split string
+        *
+        * @param array $emailHeaders
+        * @return string
+        */
+       private function formatHeaders( $emailHeaders ) {
+               return implode(
+                       "\n",
+                       array_map(
+                               function ( $v, $k ) { return "$k: $v"; },
+                               $emailHeaders,
+                               array_keys( $emailHeaders )
+                       )
+               );
        }
 
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I80b05236ef0bc45701a3ad42edbf6449e364054d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>

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

Reply via email to