Ejegg has uploaded a new change for review.

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

Change subject: Downgrade log message for empty ffname
......................................................................

Downgrade log message for empty ffname

Links to specific gateways from e.g. Ways To Give don't necessarily
have ffname specified, but we can figure out which one to show.

Still logs an error if an invalid ffname is specified.

Change-Id: Ic750486f94a0c4db8eb23bf3e8e83dbd23dc33ab
---
M gateway_common/gateway.adapter.php
1 file changed, 11 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/84/227484/1

diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index f834c10..be86a22 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -3470,15 +3470,21 @@
                        $message = "ffname '$ffname' was invalid, but the 
country-specific '$ffname-$country' works. utm_source = '$utm', referrer = 
'$ref'";
                        $this->logger->warning( $message );
                } else {
-                       //Invalid form. Go get one that is valid, and squak in 
the error logs.
+                       //Invalid form. Go get one that is valid, and squawk in 
the error logs.
                        $new_ff = GatewayFormChooser::getOneValidForm( 
$country, $currency, $payment_method, $payment_submethod, $recurring, $gateway 
);
                        $this->addRequestData( array ( 'ffname' => $new_ff ) );
 
                        //now construct a useful error message
-                       $this->logger->error(
-                               "ffname '{$ffname}' is invalid. Assigning 
ffname '{$new_ff}'. " .
-                               "I currently am choosing for: " . 
$this->getLogDebugJSON()
-                       );
+                       $message = "ffname '{$ffname}' is invalid. Assigning 
ffname '{$new_ff}'. " .
+                               "I currently am choosing for: " . 
$this->getLogDebugJSON();
+
+                       if ( empty( $ffname ) ) {
+                               // Gateway-specific link didn't specify a form, 
but we have a
+                               // default. Don't squawk too loud.
+                               $this->logger->warning( $message );
+                       } else {
+                               $this->logger->error( $message );
+                       }
 
                        //Turn these off by setting the LogDebug global to 
false.
                        $this->logger->debug( "GET: " . json_encode( $_GET ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic750486f94a0c4db8eb23bf3e8e83dbd23dc33ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

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

Reply via email to