r101207 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101206‎ | r101207 | r101208 >
Date:21:48, 28 October 2011
Author:khorn
Status:ok
Tags:
Comment:
Getting rid of unnecessary (and overzealous) logging.
This includes all outbund transactions that may include sensitive data.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/DonationData.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -42,7 +42,6 @@
4343 if ( $this->adapter->checkTokens() ) {
4444 if ( $this->adapter->posted) {
4545 // The form was submitted and the payment method has been set
46 - $this->adapter->log( "Form posted and payment method set." );
4746 // Check form for errors
4847 $form_errors = $this->validateForm( $this->errors );
4948 // If there were errors, redisplay form, otherwise proceed to next step
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
@@ -89,7 +89,6 @@
9090 $wgOut->addHTML( "<br>Redirecting to page $go" );
9191 $wgOut->redirect( $go );
9292 }
93 - $this->adapter->log( "Not posted, or not processed. Showing the form for the first time." );
9493 } else {
9594 if ( !$this->adapter->isCache() ) {
9695 // if we're not caching, there's a token mismatch
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
@@ -87,8 +87,6 @@
8888 if ( $this->adapter->checkTokens() ) {
8989 if ( $this->adapter->posted ) {
9090 // The form was submitted and the payment method has been set
91 - $this->adapter->log( "Form posted and payment method set." );
92 -
9391 /*
9492 * The $payment_method should default to false.
9593 *
@@ -133,7 +131,6 @@
134132 $result = $this->adapter->do_transaction( 'GET_ORDERSTATUS' );
135133 $this->displayResultsForDebug( $result );
136134 }
137 - $this->adapter->log( "Not posted, or not processed. Showing the form for the first time." );
138135 $this->displayForm( $this->errors );
139136 }
140137 } else {
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -476,7 +476,7 @@
477477 $xmlString = $this->stripXMLResponseHeaders( $rawResponse );
478478 $displayXML = $this->formatXmlString( $xmlString );
479479 $realXML = new DomDocument( '1.0' );
480 - self::log( "Here is the Raw XML: " . $displayXML ); //I am apparently a huge fibber.
 480+ self::log( $this->getData( 'contribution_tracking_id' ) . ": Raw XML Response:\n" . $displayXML ); //I am apparently a huge fibber.
481481 $realXML->loadXML( trim( $xmlString ) );
482482 return $realXML;
483483 }
@@ -554,8 +554,6 @@
555555 break;
556556 }
557557
558 -
559 - self::log( "Returned Data: " . print_r( $data, true ) );
560558 return $data;
561559 }
562560
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -566,9 +566,7 @@
567567 $this->xmlDoc->appendChild( $node );
568568 $xml = $this->xmlDoc->saveXML();
569569 $xmlStart = strpos( $xml, "<XML>" );
570 - self::log( "XML START" . $xmlStart );
571570 $xml = substr( $xml, $xmlStart );
572 - self::log( "XML stubby thing..." . $xml );
573571
574572 return $xml;
575573 }
@@ -616,7 +614,6 @@
617615 $this->runPreProcess(); //many hooks get fired here...
618616
619617 if ( $this->action != 'process' ) {
620 - self::log( "Transaction failed pre-process checks." . print_r( $this->getData(), true ) );
621618 return array(
622619 'status' => false,
623620 //TODO: appropriate messages.
@@ -737,7 +734,7 @@
738735 }
739736
740737 // log that the transaction is essentially complete
741 - self::log( $this->getData( 'order_id' ) . " Transaction complete." );
 738+ self::log( $this->getData( 'contribution_tracking_id' ) . " Transaction complete." );
742739
743740 //Session Handling
744741 //getTransactionStatus works here like this, because it only returns
@@ -909,12 +906,6 @@
910907 $headers = $this->getCurlBaseHeaders();
911908 $headers[] = 'Content-Length: ' . strlen( $data );
912909
913 - if ( $this->getCommunicationType() === 'xml' ) {
914 - self::log( "Sending Data: " . $this->formatXmlString( $data ) );
915 - } else {
916 - self::log( "Sending Data: " . $data );
917 - }
918 -
919910 $curl_opts = $this->getCurlBaseOpts();
920911 $curl_opts[CURLOPT_HTTPHEADER] = $headers;
921912 $curl_opts[CURLOPT_POSTFIELDS] = $data;
@@ -930,27 +921,27 @@
931922 $results = array();
932923
933924 while ( $i++ <= 3 ) {
934 - self::log( $this->postdatadefaults['order_id'] . ' Preparing to send transaction to ' . self::getGatewayName() );
 925+ self::log( $this->getData( 'contribution_tracking_id' ) . ' Preparing to send transaction to ' . self::getGatewayName() );
935926 $results['result'] = curl_exec( $ch );
936927 $results['headers'] = curl_getinfo( $ch );
937928
938929 if ( $results['headers']['http_code'] != 200 && $results['headers']['http_code'] != 403 ) {
939 - self::log( $this->postdatadefaults['order_id'] . ' Failed sending transaction to ' . self::getGatewayName() . ', retrying' );
 930+ self::log( $this->getData( 'contribution_tracking_id' ) . ' Failed sending transaction to ' . self::getGatewayName() . ', retrying' );
940931 sleep( 1 );
941932 } elseif ( $results['headers']['http_code'] == 200 || $results['headers']['http_code'] == 403 ) {
942 - self::log( $this->postdatadefaults['order_id'] . ' Finished sending transaction to ' . self::getGatewayName() );
 933+ self::log( $this->getData( 'contribution_tracking_id' ) . ' Finished sending transaction to ' . self::getGatewayName() );
943934 break;
944935 }
945936 }
946937
947 - $this->saveCommunicationStats( __FUNCTION__, $this->getCurrentTransaction(), "Request:" . print_r( $data, true ) . "\nResponse" . print_r( $results, true ) );
 938+ $this->saveCommunicationStats( __FUNCTION__, $this->getCurrentTransaction(), "Response" . print_r( $results, true ) );
948939
949940 if ( $results['headers']['http_code'] != 200 ) {
950941 $results['result'] = false;
951942 //TODO: i18n here!
952943 //TODO: But also, fire off some kind of "No response from the gateway" thing to somebody so we know right away.
953944 $results['message'] = 'No response from ' . self::getGatewayName() . '. Please try again later!';
954 - self::log( $this->postdatadefaults['order_id'] . ' No response from ' . self::getGatewayName() . ': ' . curl_error( $ch ) );
 945+ self::log( $this->getData( 'contribution_tracking_id' ) . ' No response from ' . self::getGatewayName() . ': ' . curl_error( $ch ) );
955946 curl_close( $ch );
956947 return false;
957948 }
@@ -967,7 +958,7 @@
968959 $xmlStart = strpos( $rawResponse, '<RESPONSE' );
969960 }
970961 if ( $xmlStart == false ) { //Still false. Your Head Asplode.
971 - self::log( "Wow, that was so messed up I couldn't even parse the response, so here's the thing in its entirety:\n" . $rawResponse );
 962+ self::log( "Completely Mangled Response:\n" . $rawResponse );
972963 return false;
973964 }
974965 $justXML = substr( $rawResponse, $xmlStart );
@@ -1168,14 +1159,12 @@
11691160 if ( $upper >= $code ) { //you've arrived. It's either here or it's nowhere.
11701161 if ( is_array( $val ) ) {
11711162 if ( $val['lower'] <= $code ) {
1172 - $this->saveCommunicationStats( __FUNCTION__, $transaction, "code = $code" );
11731163 return $val['action'];
11741164 } else {
11751165 return null;
11761166 }
11771167 } else {
11781168 if ( $upper === $code ) {
1179 - $this->saveCommunicationStats( __FUNCTION__, $transaction, "code = $code" );
11801169 return $val;
11811170 } else {
11821171 return null;
@@ -1249,8 +1238,6 @@
12501239 //'language' => '',
12511240 );
12521241 $transaction += $this->getDisplayData();
1253 -
1254 - self::log( "Intended STOMP transaction: " . print_r( $transaction, true ) );
12551242
12561243 try {
12571244 wfRunHooks( $hook, array( $transaction ) );
@@ -1511,9 +1498,9 @@
15121499 return;
15131500 }
15141501 // allow any external validators to have their way with the data
1515 - self::log( $this->getData( 'order_id' ) . " Preparing to query MaxMind" );
 1502+ self::log( $this->getData( 'contribution_tracking_id' ) . " Preparing to query MaxMind" );
15161503 wfRunHooks( 'GatewayValidate', array( &$this ) );
1517 - self::log( $this->getData( 'order_id' ) . ' Finished querying Maxmind' );
 1504+ self::log( $this->getData( 'contribution_tracking_id' ) . ' Finished querying Maxmind' );
15181505
15191506 // if the transaction was flagged for review
15201507 if ( $this->action == 'review' ) {
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php
@@ -101,7 +101,6 @@
102102 * populateData helper function
103103 * If donor session data has been set, pull the fields in the session that
104104 * are populated, and merge that with the data set we already have.
105 - * Then, unset the session variable to avoid later confusion.
106105 */
107106 function integrateDataFromSession(){
108107 self::ensureSession();
@@ -478,17 +477,15 @@
479478 $sessionToken = $this->getEditToken( $salt );
480479 if ( $val != $sessionToken ) {
481480 wfDebug( "DonationData::matchEditToken: broken session data\n" );
 481+ //and reset the token for next time.
 482+ $this->expunge( 'token' );
482483 }
483 - $this->log( "Val = $val" );
484 - $this->log( "Session Token = $sessionToken" );
485484 return $val == $sessionToken;
486485 }
487486
 487+
488488 /**
489 - * Unset the payflow edit token from a user's session.
490 - *
491 - * TODO: Get rid of this, if we end up using the new, much more draconian
492 - * killAllSessionEverything().
 489+ * unsets the edit token in the user's session.
493490 */
494491 function unsetEditToken() {
495492 $gateway_ident = $this->gatewayID;

Follow-up revisions

RevisionCommit summaryAuthorDate
r101212MFT r101207awjrichards21:57, 28 October 2011

Status & tagging log