jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/356647 )

Change subject: Break long lines
......................................................................


Break long lines

Prepare to make phpcs pass

Change-Id: I3e88e147aad5a2896e190571fce354cc3a623b41
---
M BounceHandler.php
M BounceHandlerHooks.php
M includes/BounceHandlerActions.php
M includes/ProcessBounceEmails.php
M includes/ProcessBounceWithRegex.php
M includes/ProcessUnRecognizedBounces.php
M includes/VerpAddressGenerator.php
M tests/VERPEncodeDecodeTest.php
8 files changed, 51 insertions(+), 26 deletions(-)

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



diff --git a/BounceHandler.php b/BounceHandler.php
index abe09c4..fb53a70 100644
--- a/BounceHandler.php
+++ b/BounceHandler.php
@@ -4,10 +4,11 @@
        // Keep i18n globals so mergeMessageFileList.php doesn't break
        $wgMessagesDirs['BounceHandler'] = __DIR__ . '/i18n';
        /* wfWarn(
-               'Deprecated PHP entry point used for BounceHandler extension. 
Please use wfLoadExtension instead, ' .
+               'Deprecated PHP entry point used for BounceHandler extension. ' 
.
+               'Please use wfLoadExtension instead, ' .
                'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
        ); */
        return;
 } else {
        die( 'This version of the BounceHandler extension requires MediaWiki 
1.25+' );
-}
\ No newline at end of file
+}
diff --git a/BounceHandlerHooks.php b/BounceHandlerHooks.php
index 3976953..19130d1 100644
--- a/BounceHandlerHooks.php
+++ b/BounceHandlerHooks.php
@@ -98,9 +98,15 @@
         */
        public static function LoadExtensionSchemaUpdates( DatabaseUpdater 
$updater ) {
                $updater->addExtensionTable( 'bounce_records', __DIR__ . 
'/sql/bounce_records.sql' );
-               $updater->modifyExtensionField( 'bounce_records', 'br_user', 
__DIR__ . '/sql/alter_user_column.sql' );
-               $updater->addExtensionIndex( 'bounce_records', 
'br_mail_timestamp', __DIR__ .'/sql/create_index_mail_timestamp.sql' );
-               $updater->addExtensionIndex( 'bounce_records', 'br_timestamp', 
__DIR__ .'/sql/create_index_timestamp.sql' );
+               $updater->modifyExtensionField(
+                       'bounce_records', 'br_user', __DIR__ . 
'/sql/alter_user_column.sql'
+               );
+               $updater->addExtensionIndex(
+                       'bounce_records', 'br_mail_timestamp', __DIR__ 
.'/sql/create_index_mail_timestamp.sql'
+               );
+               $updater->addExtensionIndex(
+                       'bounce_records', 'br_timestamp', __DIR__ 
.'/sql/create_index_timestamp.sql'
+               );
 
                return true;
        }
diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index ad0bf8f..cb5a0f3 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -38,13 +38,15 @@
 
        /**
         * @param string $wikiId The database id of the failing recipient
-        * @param int $bounceRecordPeriod Time period for which bounce 
activities are considered before un-subscribing
+        * @param int $bounceRecordPeriod Time period for which bounce 
activities are considered
+        *  before un-subscribing
         * @param int $bounceRecordLimit The number of bounce allowed in the 
bounceRecordPeriod.
         * @param bool $bounceHandlerUnconfirmUsers Enable/Disable user 
un-subscribe action
         * @param string $emailRaw The raw bounce Email
         * @throws Exception
         */
-       public function __construct( $wikiId, $bounceRecordPeriod, 
$bounceRecordLimit, $bounceHandlerUnconfirmUsers, $emailRaw
+       public function __construct(
+               $wikiId, $bounceRecordPeriod, $bounceRecordLimit, 
$bounceHandlerUnconfirmUsers, $emailRaw
        ) {
                if ( $wikiId !== wfWikiID() ) {
                        // We want to use the User class methods, which make no 
sense on the wrong wiki
@@ -110,7 +112,8 @@
        }
 
        /**
-        * Function to inject Echo notification to the last source of bounce 
for an unsubscribed Global user
+        * Function to inject Echo notification to the last source of bounce 
for an
+        * unsubscribed Global user
         *
         * @param $bounceUserId
         * @param $originalEmail
@@ -149,7 +152,8 @@
                                $caUser->saveSettings();
                                $this->notifyGlobalUser( $bounceUserId, 
$originalEmail );
                                wfDebugLog( 'BounceHandler',
-                                       "Un-subscribed global user 
{$caUser->getName()} <$originalEmail> for exceeding Bounce Limit 
$this->bounceRecordLimit.\nProcessed Headers:\n" .
+                                       "Un-subscribed global user 
{$caUser->getName()} <$originalEmail> for " .
+                                               "exceeding Bounce Limit 
$this->bounceRecordLimit.\nProcessed Headers:\n" .
                                                $this->formatHeaders( 
$emailHeaders ) . "\nBounced Email: \n$this->emailRaw"
                                );
                                
RequestContext::getMain()->getStats()->increment( 'bouncehandler.unsub.global' 
);
@@ -160,7 +164,8 @@
                        $user->saveSettings();
                        $this->createEchoNotification( $bounceUserId, 
$originalEmail );
                        wfDebugLog( 'BounceHandler',
-                               "Un-subscribed {$user->getName()} 
<$originalEmail> for exceeding Bounce limit 
$this->bounceRecordLimit.\nProcessed Headers:\n" .
+                               "Un-subscribed {$user->getName()} 
<$originalEmail> for exceeding Bounce limit " .
+                                       "$this->bounceRecordLimit.\nProcessed 
Headers:\n" .
                                        $this->formatHeaders( $emailHeaders ). 
"\nBounced Email: \n$this->emailRaw"
                        );
                        RequestContext::getMain()->getStats()->increment( 
'bouncehandler.unsub.local' );
diff --git a/includes/ProcessBounceEmails.php b/includes/ProcessBounceEmails.php
index 1a37e1d..92cfc49 100644
--- a/includes/ProcessBounceEmails.php
+++ b/includes/ProcessBounceEmails.php
@@ -54,14 +54,16 @@
         * @return bool
         */
        public function processBounceHeaders( $emailHeaders, $emailRaw ) {
-               global $wgBounceRecordPeriod, $wgBounceRecordLimit, 
$wgBounceHandlerUnconfirmUsers, $wgBounceRecordMaxAge;
+               global $wgBounceRecordPeriod, $wgBounceRecordLimit,
+                       $wgBounceHandlerUnconfirmUsers, $wgBounceRecordMaxAge;
+
                $to = $emailHeaders['to'];
                $subject = $emailHeaders['subject'];
 
                // Get original failed user email and wiki details
                $failedUser = $to ? $this->getUserDetails( $to ) : false;
-               if ( is_array( $failedUser ) && isset( $failedUser['wikiId'] ) 
&& isset( $failedUser['rawEmail'] )
-                       && isset( $failedUser[ 'bounceTime' ] )
+               if ( is_array( $failedUser ) && isset( $failedUser['wikiId'] )
+                       && isset( $failedUser['rawEmail'] ) && isset( 
$failedUser[ 'bounceTime' ] )
                ) {
                        $wikiId = $failedUser['wikiId'];
                        $originalEmail = $failedUser['rawEmail'];
@@ -91,7 +93,9 @@
                        $takeBounceActions->handleFailingRecipient( 
$failedUser, $emailHeaders );
                        return true;
                } else {
-                       wfDebugLog( 'BounceHandler', "Error: Failed to extract 
user details from verp address $to " );
+                       wfDebugLog( 'BounceHandler',
+                               "Error: Failed to extract user details from 
verp address $to"
+                       );
                        return false;
                }
        }
@@ -111,7 +115,9 @@
                $currentTime = wfTimestamp();
                preg_match( '~(.*?)@~', $hashedEmail, $hashedPart );
                if ( !isset( $hashedPart[1] ) ) {
-                       wfDebugLog( 'BounceHandler', "Error: The received 
address: $hashedEmail does not match the VERP pattern." );
+                       wfDebugLog( 'BounceHandler',
+                               "Error: The received address: $hashedEmail does 
not match the VERP pattern."
+                       );
                        return array();
                }
                $hashedVERPPart = explode( '-', $hashedPart[1] );
@@ -175,7 +181,9 @@
                        return $rawEmail;
                }
 
-               wfDebugLog( 'BounceHandler',"Error fetching email_id of user_id 
$rawUserId from Database $wikiId." );
+               wfDebugLog( 'BounceHandler',
+                       "Error fetching email_id of user_id $rawUserId from 
Database $wikiId."
+               );
                return false;
        }
 
@@ -211,7 +219,8 @@
                global $wgUnrecognizedBounceNotify, $wgPasswordSender;
 
                wfDebugLog( 'BounceHandler', "Received temporary bounce from 
$to" );
-               $handleUnIdentifiedBounce = new ProcessUnRecognizedBounces( 
$wgUnrecognizedBounceNotify, $wgPasswordSender );
+               $handleUnIdentifiedBounce = new ProcessUnRecognizedBounces(
+                       $wgUnrecognizedBounceNotify, $wgPasswordSender );
                $handleUnIdentifiedBounce->processUnRecognizedBounces( $email );
        }
 
diff --git a/includes/ProcessBounceWithRegex.php 
b/includes/ProcessBounceWithRegex.php
index 1f33319..42f3e85 100644
--- a/includes/ProcessBounceWithRegex.php
+++ b/includes/ProcessBounceWithRegex.php
@@ -100,8 +100,8 @@
                        $emailHeaders['status'] = $status;
                }
 
-               // If the x-failed-recipient header or status code was not 
found, we should fallback to a heuristic scan
-               // of the message for a SMTP status code
+               // If the x-failed-recipient header or status code was not 
found, we should fallback to
+               // a heuristic scan of the message for a SMTP status code
                if ( !isset( $emailHeaders['status'] ) && !isset( 
$emailHeaders['x-failed-recipients'] ) ) {
                        foreach ( $emailLines as $emailLine ) {
                                if ( preg_match( 
'/\s+(?:(?P<smtp>[1-5]\d{2}).)?' .
diff --git a/includes/ProcessUnRecognizedBounces.php 
b/includes/ProcessUnRecognizedBounces.php
index 607e910..f486ee7 100644
--- a/includes/ProcessUnRecognizedBounces.php
+++ b/includes/ProcessUnRecognizedBounces.php
@@ -21,7 +21,8 @@
        protected $unrecognizedBounceNotify;
 
        /**
-        * @param array $unrecognizedBounceNotify The array of admins to be 
notified on a bounce parse failure
+        * @param array $unrecognizedBounceNotify The array of admins to be 
notified
+        *   on a bounce parse failure
         * @param string $passwordSender The default email Return path address
         */
        public function __construct( $unrecognizedBounceNotify, $passwordSender 
) {
@@ -36,7 +37,8 @@
         */
        public function processUnRecognizedBounces( $email ) {
                $subject = 'bouncehandler-notify_subject';
-               $sender = new MailAddress( $this->passwordSender, wfMessage( 
'emailsender' )->inContentLanguage()->text() );
+               $sender = new MailAddress( $this->passwordSender,
+                       wfMessage( 'emailsender' )->inContentLanguage()->text() 
);
                $to = array();
                if ( $this->unrecognizedBounceNotify !== null ) {
                        foreach ( $this->unrecognizedBounceNotify as 
$notifyEmails ) {
diff --git a/includes/VerpAddressGenerator.php 
b/includes/VerpAddressGenerator.php
index 60a9890..4cac52d 100644
--- a/includes/VerpAddressGenerator.php
+++ b/includes/VerpAddressGenerator.php
@@ -49,11 +49,12 @@
         * The generated hash is cut down to 12 ( 96 bits ) instead of the full 
120 bits.
         * For attacks attempting to recover the hmac key, this makes the 
attackers job harder by giving
         * them less information to work from.
-        * This makes brute force attacks easier. An attacker would be able to 
brute force the signature by
-        * sending an average of 2^95 emails to us. We would (hopefully) notice 
that.
+        * This makes brute force attacks easier. An attacker would be able to 
brute force the signature
+        * by sending an average of 2^95 emails to us. We would (hopefully) 
notice that.
         * This would make finding a collision slightly easier if the secret 
key was known,
-        * but the constraints on each segment (wiki id must be valid, 
timestamp needs to be within a certain limit),
-        * combined with the difficulty of finding collisions when the key is 
unknown, makes this virtually impossible.
+        * but the constraints on each segment (wiki id must be valid, 
timestamp needs to be within a
+        * certain limit), combined with the difficulty of finding collisions 
when the key is unknown,
+        * makes this virtually impossible.
         *
         * @param int $uid user-id of the failing user
         * @return string $ReturnPath address
diff --git a/tests/VERPEncodeDecodeTest.php b/tests/VERPEncodeDecodeTest.php
index 1b87087..0655614 100644
--- a/tests/VERPEncodeDecodeTest.php
+++ b/tests/VERPEncodeDecodeTest.php
@@ -53,7 +53,8 @@
                        $decodeVERPwithPlancake = new 
ProcessBounceWithPlancake();
 
                        $userDetailsWithPlancake = 
$decodeVERPwithPlancake->getUserDetails( $encodedAddress );
-                       $decodeAddressWithPlancake = 
$decodeVERPwithPlancake->getOriginalEmail( $userDetailsWithPlancake );
+                       $decodeAddressWithPlancake = 
$decodeVERPwithPlancake->getOriginalEmail(
+                               $userDetailsWithPlancake );
 
                        // Check if the source address and the decoded address 
match
                        $this->assertEquals( $user->getEmail() , 
$decodeAddressWithPlancake );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3e88e147aad5a2896e190571fce354cc3a623b41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: Jforrester <jforres...@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