Ejegg has uploaded a new change for review.

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

Change subject: Revert "Use DonationLogger in GatewayPage subclasses"
......................................................................

Revert "Use DonationLogger in GatewayPage subclasses"

This reverts commit 6230aaaf8e5fea18ed26437307e3509d26cd8282.

Bug: T86266
Change-Id: I95c4cfee9073e59a99dbc3528b3394c4d256a3f3
---
M adyen_gateway/adyen_resultswitcher.body.php
M amazon_gateway/amazon_gateway.body.php
M gateway_common/GatewayPage.php
M gateway_forms/RapidHtml.php
M globalcollect_gateway/globalcollect_resultswitcher.body.php
M paypal_gateway/paypal_resultswitcher.body.php
6 files changed, 25 insertions(+), 25 deletions(-)


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

diff --git a/adyen_gateway/adyen_resultswitcher.body.php 
b/adyen_gateway/adyen_resultswitcher.body.php
index 666dcf7..72bbe5a 100644
--- a/adyen_gateway/adyen_resultswitcher.body.php
+++ b/adyen_gateway/adyen_resultswitcher.body.php
@@ -55,11 +55,11 @@
                global $wgServer;
                if ( ( strpos( $referrer, $wgServer ) === false ) && 
!$liberated ) {
                        $_SESSION[ 'order_status' ][ $oid ] = 'liberated';
-                       DonationLogger::log("Resultswitcher: Popping out of 
iframe for Order ID " . $oid);
+                       $this->adapter->log("Resultswitcher: Popping out of 
iframe for Order ID " . $oid);
                        //TODO: Move the $forbidden check back to the beginning 
of this if block, once we know this doesn't happen a lot.
                        //TODO: If we get a lot of these messages, we need to 
redirect to something more friendly than FORBIDDEN, RAR RAR RAR.
                        if ( $forbidden ) {
-                               DonationLogger::log("Resultswitcher: $oid 
SHOULD BE FORBIDDEN. Reason: $f_message", LOG_ERR);
+                               $this->adapter->log("Resultswitcher: $oid 
SHOULD BE FORBIDDEN. Reason: $f_message", LOG_ERR);
                        }
                        $this->getOutput()->allowClickjacking();
                        $this->getOutput()->addModules( 'iframe.liberator' );
@@ -69,10 +69,10 @@
                $this->setHeaders();
 
                if ( $forbidden ){
-                       DonationLogger::log( "Resultswitcher: Request 
forbidden. " . $f_message . " Adapter Order ID: $oid", LOG_CRIT );
+                       $this->adapter->log( "Resultswitcher: Request 
forbidden. " . $f_message . " Adapter Order ID: $oid", LOG_CRIT );
                        return;
                } else {
-                       DonationLogger::log( "Resultswitcher: OK to process 
Order ID: " . $oid );
+                       $this->adapter->log( "Resultswitcher: OK to process 
Order ID: " . $oid );
                }
 
                if ( $this->adapter->checkTokens() ) {
@@ -91,7 +91,7 @@
                                $this->getOutput()->redirect( 
$this->adapter->getFailPage() );
                        }
                } else {
-                       DonationLogger::log( "Resultswitcher: Token Check 
Failed. Order ID: $oid", LOG_ERR );
+                       $this->adapter->log( "Resultswitcher: Token Check 
Failed. Order ID: $oid", LOG_ERR );
                }
        }
 
diff --git a/amazon_gateway/amazon_gateway.body.php 
b/amazon_gateway/amazon_gateway.body.php
index b13bf91..785f4b9 100644
--- a/amazon_gateway/amazon_gateway.body.php
+++ b/amazon_gateway/amazon_gateway.body.php
@@ -50,7 +50,7 @@
                                return;
                        }
 
-                       DonationLogger::log( 'At gateway return with params: ' 
. json_encode( $this->getRequest()->getValues() ), LOG_INFO );
+                       $this->log( 'At gateway return with params: ' . 
json_encode( $this->getRequest()->getValues() ), LOG_INFO );
                        if ( $this->adapter->checkTokens() && 
$this->getRequest()->getText( 'status' ) ) {
                                $this->adapter->do_transaction( 
'ProcessAmazonReturn' );
 
@@ -67,7 +67,7 @@
                                if ( !is_null( $specialform ) && 
$this->adapter->isValidSpecialForm( $specialform ) ){
                                        $this->displayForm();
                                } else {
-                                       DonationLogger::log( 'Failed to process 
gateway return. Tokens bad or no status.', LOG_ERR );
+                                       $this->log( 'Failed to process gateway 
return. Tokens bad or no status.', LOG_ERR );
                                }
                        }
                }
diff --git a/gateway_common/GatewayPage.php b/gateway_common/GatewayPage.php
index 85c7b65..f342786 100644
--- a/gateway_common/GatewayPage.php
+++ b/gateway_common/GatewayPage.php
@@ -128,7 +128,7 @@
                        $page = $this->adapter->getGlobal( "FailPage" );
 
                        $log_message = '"Redirecting to [ ' . $page . ' ] "';
-                       DonationLogger::log( $log_message, LOG_INFO );
+                       $this->log( $log_message, LOG_INFO );
 
                        if ( $page ) {
 
@@ -218,7 +218,7 @@
         * @param int|string $log_level The severity level of the message.
         */
        public function log( $msg, $log_level=LOG_INFO ) {
-               DonationLogger::log( $msg, $log_level );
+               $this->adapter->log( $msg, $log_level );
        }
 
        /**
@@ -341,7 +341,7 @@
                        'currency_code' => $defaultCurrency
                ) );
 
-               DonationLogger::log( "Unsupported currency $oldCurrency forced 
to $defaultCurrency" );
+               $this->adapter->log( "Unsupported currency $oldCurrency forced 
to $defaultCurrency" );
                return true;
        }
 }
diff --git a/gateway_forms/RapidHtml.php b/gateway_forms/RapidHtml.php
index 4634eb7..d6cff83 100644
--- a/gateway_forms/RapidHtml.php
+++ b/gateway_forms/RapidHtml.php
@@ -134,7 +134,7 @@
                                $this->set_html_file_path( $ffname );
                        } catch ( MWException $mwe ) {
                                $message = "Could not load form '$ffname'";
-                               DonationLogger::log( $message, LOG_ERR );
+                               $this->gateway->log( $message, LOG_ERR );
                                $this->set_html_file_path( 'error-noform' );
                        }
                }
@@ -492,7 +492,7 @@
                if ( $problems ){
                        if ( $fatal ){
                                $message = 'Requested an unavailable or 
non-existent form.';
-                               DonationLogger::log( $message . ' ' . 
$debug_message . ' ' . $this->gateway->getData_Unstaged_Escaped('utm_source') , 
LOG_ERR );
+                               $this->gateway->log( $message . ' ' . 
$debug_message . ' ' . $this->gateway->getData_Unstaged_Escaped('utm_source') , 
LOG_ERR );
                                throw new MWException( $message ); # TODO: 
translate
                        } else {
                                return;
diff --git a/globalcollect_gateway/globalcollect_resultswitcher.body.php 
b/globalcollect_gateway/globalcollect_resultswitcher.body.php
index 5e5c6af..f4e8cbf 100644
--- a/globalcollect_gateway/globalcollect_resultswitcher.body.php
+++ b/globalcollect_gateway/globalcollect_resultswitcher.body.php
@@ -70,18 +70,18 @@
                        $f_message = "Requested order id not present in the 
session. (session_oid = '$session_oid')";
 
                        if ( !$_SESSION ) {
-                               DonationLogger::log( "Resultswitcher: 
{$this->qs_oid} Is popped out, but still has no session data.", LOG_ERR );
+                               $this->adapter->log( "Resultswitcher: 
{$this->qs_oid} Is popped out, but still has no session data.", LOG_ERR );
                        }
                }
 
                if ( $forbidden ){
-                       DonationLogger::log( $this->qs_oid . " Resultswitcher: 
forbidden for reason: {$f_message}", LOG_ERR );
+                       $this->adapter->log( $this->qs_oid . " Resultswitcher: 
forbidden for reason: {$f_message}", LOG_ERR );
                        wfHttpError( 403, 'Forbidden', wfMessage( 
'donate_interface-error-http-403' )->text() );
                        return;
                }
 
                $this->setHeaders();
-               DonationLogger::log( "Resultswitcher: OK to process Order ID: " 
. $this->qs_oid );
+               $this->adapter->log( "Resultswitcher: OK to process Order ID: " 
. $this->qs_oid );
 
                // dispatch forms/handling
                if ( $this->adapter->checkTokens() ) {
@@ -97,7 +97,7 @@
                                        if ( array_key_exists( 'pending', 
$_SESSION ) ){
                                                $started = $_SESSION['pending'];
                                                //not sure what to do with this 
yet, but I sure want to know if it's happening. 
-                                               DonationLogger::log( 
"Resultswitcher: Parallel Universe Unlocked. Start time: $started", LOG_ALERT );
+                                               $this->adapter->log( 
"Resultswitcher: Parallel Universe Unlocked. Start time: $started", LOG_ALERT );
                                        }
                                        
                                        $_SESSION['pending'] = microtime( true 
); //We couldn't have gotten this far if the server wasn't sticky. 
@@ -106,7 +106,7 @@
                                        
$_SESSION['order_status'][$oid]['data']['count'] = 0;
                                } else {
                                        
$_SESSION['order_status'][$oid]['data']['count'] = 
$_SESSION['order_status'][$oid]['data']['count'] + 1;
-                                       DonationLogger::log( "Resultswitcher: 
Multiple attempts to process. " . 
$_SESSION['order_status'][$oid]['data']['count'], LOG_ERR );
+                                       $this->adapter->log( "Resultswitcher: 
Multiple attempts to process. " . 
$_SESSION['order_status'][$oid]['data']['count'], LOG_ERR );
                                }
                                $result = $_SESSION['order_status'][$oid];
                                $this->displayResultsForDebug( $result );
@@ -128,16 +128,16 @@
                                                $this->getOutput()->addHTML( 
"<br>Redirecting to page $go" );
                                                $this->getOutput()->redirect( 
$go );
                                        } else {
-                                               
DonationLogger::log("Resultswitcher: No redirect defined. Order ID: $oid", 
LOG_ERR);
+                                               
$this->adapter->log("Resultswitcher: No redirect defined. Order ID: $oid", 
LOG_ERR);
                                        }
                                } else {
-                                       DonationLogger::log("Resultswitcher: No 
FinalStatus. Order ID: $oid", LOG_ERR);
+                                       $this->adapter->log("Resultswitcher: No 
FinalStatus. Order ID: $oid", LOG_ERR);
                                }
                        } else {
-                               DonationLogger::log("Resultswitcher: Payment 
method is not cc. Order ID: $oid", LOG_ERR);
+                               $this->adapter->log("Resultswitcher: Payment 
method is not cc. Order ID: $oid", LOG_ERR);
                        }
                } else {
-                       DonationLogger::log("Resultswitcher: Token Check 
Failed. Order ID: $oid", LOG_ERR);
+                       $this->adapter->log("Resultswitcher: Token Check 
Failed. Order ID: $oid", LOG_ERR);
                }
        }
        
@@ -169,17 +169,17 @@
                $referrer = $this->getRequest()->getHeader( 'referer' );
                if ( ( strpos( $referrer, $wgServer ) === false ) ) {
                        if ( !$_SESSION ) {
-                               DonationLogger::log( "Resultswitcher: 
{$this->qs_oid} warning: iframed script cannot see session cookie.", LOG_ERR );
+                               $this->adapter->log( "Resultswitcher: 
{$this->qs_oid} warning: iframed script cannot see session cookie.", LOG_ERR );
                        }
 
                        $_SESSION['order_status'][$this->qs_oid] = 'liberated';
-                       DonationLogger::log("Resultswitcher: Popping out of 
iframe for Order ID " . $this->qs_oid);
+                       $this->adapter->log("Resultswitcher: Popping out of 
iframe for Order ID " . $this->qs_oid);
 
                        $this->getOutput()->allowClickjacking();
                        $this->getOutput()->addModules( 'iframe.liberator' );
                        return true;
                }
 
-               DonationLogger::log( "Resultswitcher: good, it appears we are 
not in an iframe. Order ID {$this->qs_oid}" );
+               $this->adapter->log( "Resultswitcher: good, it appears we are 
not in an iframe. Order ID {$this->qs_oid}" );
        }
 }
diff --git a/paypal_gateway/paypal_resultswitcher.body.php 
b/paypal_gateway/paypal_resultswitcher.body.php
index b157cbd..3056534 100644
--- a/paypal_gateway/paypal_resultswitcher.body.php
+++ b/paypal_gateway/paypal_resultswitcher.body.php
@@ -63,7 +63,7 @@
 */
                        $this->getOutput()->redirect( 
$this->adapter->getThankYouPage() );
                } else {
-                       DonationLogger::log("Resultswitcher: Token Check 
Failed. Order ID: $oid");
+                       $this->adapter->log("Resultswitcher: Token Check 
Failed. Order ID: $oid");
                        $this->getOutput()->redirect( 
$this->adapter->getFailPage() );
                }
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95c4cfee9073e59a99dbc3528b3394c4d256a3f3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to