Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | |
112 | 112 | // make a log entry if the user has submitted the cc form |
113 | 113 | if ( $wgRequest->wasPosted() && $wgRequest->getText( 'process', 0 )) { |
114 | | - wfDebugLog( 'payflowpro_gateway', $payflow_data[ 'order_id' ] . " Transaction initiated." ); |
| 114 | + self::log( $payflow_data[ 'order_id' ] . " Transaction initiated." ); |
115 | 115 | } |
116 | 116 | |
117 | 117 | // if _cache_ is requested by the user, do not set a session/token; dynamic data will be loaded via ajax |
— | — | @@ -163,9 +163,9 @@ |
164 | 164 | $this->fnPayflowDisplayForm( $data, $this->errors ); |
165 | 165 | } else { // The submitted form data is valid, so process it |
166 | 166 | // allow any external validators to have their way with the data |
167 | | - wfDebugLog( 'payflowpro_gateway', $data[ 'order_id' ] . " Preparing to query MaxMind" ); |
| 167 | + self::log( $data[ 'order_id' ] . " Preparing to query MaxMind" ); |
168 | 168 | wfRunHooks( 'PayflowGatewayValidate', array( &$this, &$data ) ); |
169 | | - wfDebugLog( 'payflowpro_gateway', $data[ 'order_id' ] . ' Finished querying Maxmind' ); |
| 169 | + self::log( $data[ 'order_id' ] . ' Finished querying Maxmind' ); |
170 | 170 | |
171 | 171 | // if the transaction was flagged for review |
172 | 172 | if ( $this->action == 'review' ) { |
— | — | @@ -227,7 +227,7 @@ |
228 | 228 | $tracked = $this->fnPayflowSaveContributionTracking( $data ); |
229 | 229 | if ( !$tracked ) { |
230 | 230 | $when = time(); |
231 | | - wfDebugLog( 'payflowpro_gateway', $data[ 'order_id' ] . ' Unable to save data to the contribution_tracking table ' . $when ); |
| 231 | + self::log( $data[ 'order_id' ] . ' Unable to save data to the contribution_tracking table ' . $when ); |
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
— | — | @@ -454,15 +454,15 @@ |
455 | 455 | $i = 1; |
456 | 456 | |
457 | 457 | while ( $i++ <= 3 ) { |
458 | | - wfDebugLog( 'payflowpro_gateway', $data[ 'order_id' ] . ' Preparing to send transaction to PayflowPro' ); |
| 458 | + self::log( $data[ 'order_id' ] . ' Preparing to send transaction to PayflowPro' ); |
459 | 459 | $result = curl_exec( $ch ); |
460 | 460 | $headers = curl_getinfo( $ch ); |
461 | 461 | |
462 | 462 | if ( $headers['http_code'] != 200 && $headers['http_code'] != 403 ) { |
463 | | - wfDebugLog( 'payflowpro_gateway', $data[ 'order_id' ] . ' Failed sending transaction to PayflowPro, retrying' ); |
| 463 | + self::log( $data[ 'order_id' ] . ' Failed sending transaction to PayflowPro, retrying' ); |
464 | 464 | sleep( 1 ); |
465 | 465 | } elseif ( $headers['http_code'] == 200 || $headers['http_code'] == 403 ) { |
466 | | - wfDebugLog( 'payflowpro_gateway', $data[ 'order_id' ] . ' Finished sending transaction to PayflowPro' ); |
| 466 | + self::log( $data[ 'order_id' ] . ' Finished sending transaction to PayflowPro' ); |
467 | 467 | break; |
468 | 468 | } |
469 | 469 | } |
— | — | @@ -470,7 +470,7 @@ |
471 | 471 | if ( $headers['http_code'] != 200 ) { |
472 | 472 | $wgOut->addHTML( '<h3>No response from credit card processor. Please try again later!</h3><p>' ); |
473 | 473 | $when = time(); |
474 | | - wfDebugLog( 'payflowpro_gateway', $data[ 'order_id' ] . ' No response from credit card processor: ' . curl_error( $ch )); |
| 474 | + self::log( $data[ 'order_id' ] . ' No response from credit card processor: ' . curl_error( $ch ) ); |
475 | 475 | curl_close( $ch ); |
476 | 476 | return; |
477 | 477 | } |
— | — | @@ -523,7 +523,7 @@ |
524 | 524 | $errorCode = $this->fnPayflowGetResponseMsg( $resultCode, $responseMsg ); |
525 | 525 | |
526 | 526 | // log that the transaction is essentially complete |
527 | | - wfDebugLog( 'payflowpro_gateway', $data[ 'order_id' ] . " Transaction complete." ); |
| 527 | + self::log( $data[ 'order_id' ] . " Transaction complete." ); |
528 | 528 | |
529 | 529 | // if approved, display results and send transaction to the queue |
530 | 530 | if ( $errorCode == '1' ) { |
— | — | @@ -1261,4 +1261,19 @@ |
1262 | 1262 | // submit the data to the paypal redirect URL |
1263 | 1263 | $wgOut->redirect( $wgPayflowGatewayPaypalURL . '&' . http_build_query( $data ) ); |
1264 | 1264 | } |
| 1265 | + |
| 1266 | + public static function log( $msg, $identifier='payflowpro_gateway', $log_level=LOG_INFO ) { |
| 1267 | + global $wgPayflowGatewayUseSyslog; |
| 1268 | + |
| 1269 | + // if we're not using the syslog facility, use wfDebugLog |
| 1270 | + if ( !$wgPayflowGatewayUseSyslog ) { |
| 1271 | + wfDebugLog( $identifier, $msg ); |
| 1272 | + return; |
| 1273 | + } |
| 1274 | + |
| 1275 | + // otherwise, use syslogging |
| 1276 | + openlog( $identifier, LOG_ODELAY, LOG_SYSLOG ); |
| 1277 | + syslog( $log_level, $msg ); |
| 1278 | + closelog(); |
| 1279 | + } |
1265 | 1280 | } // end class |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha-php/recaptchalib.php |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | |
127 | 127 | $response = ''; |
128 | 128 | if ( false == ( $fs = @fsockopen( $host, $port, $errno, $errstr, 10 ) ) ) { |
129 | | - wfDebugLog( 'payflowpro_gateway', 'Failed communicating with reCaptcha.' ); |
| 129 | + PayflowProGateway::log( 'Failed communicating with reCaptcha.' ); |
130 | 130 | die ( 'Could not open socket' ); |
131 | 131 | } |
132 | 132 | |
— | — | @@ -160,18 +160,18 @@ |
161 | 161 | |
162 | 162 | // set proxy settings if necessary |
163 | 163 | if ( RECAPTCHA_USE_HTTP_PROXY ) { |
164 | | - wfDebugLog( 'payflowpro_gateway', 'Using http proxy ' . RECAPTCHA_HTTP_PROXY ); |
| 164 | + PayflowProGateway::log( 'Using http proxy ' . RECAPTCHA_HTTP_PROXY ); |
165 | 165 | curl_setopt( $ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP ); |
166 | 166 | curl_setopt( $ch, CURLOPT_PROXY, RECAPTCHA_HTTP_PROXY ); |
167 | 167 | } |
168 | 168 | |
169 | 169 | // try up to three times |
170 | 170 | for ( $i = 0; $i < RECAPTCHA_RETRY_LIMIT; $i++ ) { |
171 | | - wfDebugLog( 'payflowpro_gateway', 'Preparing to communicate with reCaptcha via cURL at ' . $url . '.' ); |
| 171 | + PayflowProGateway::log( 'Preparing to communicate with reCaptcha via cURL at ' . $url . '.' ); |
172 | 172 | $response = curl_exec( $ch ); |
173 | | - wfDebugLog( 'payflowpro_gateway', "Finished communicating with reCaptcha." ); |
| 173 | + PayflowProGateway::log( "Finished communicating with reCaptcha." ); |
174 | 174 | if ( $response ) { |
175 | | - wfDebugLog( 'payflowpro_gateway', 'Response from reCaptcha: ' . $response ); |
| 175 | + PayflowProGateway::log( 'Response from reCaptcha: ' . $response ) |
176 | 176 | break; |
177 | 177 | } |
178 | 178 | } |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | * the user entered the correct values. |
188 | 188 | */ |
189 | 189 | if ( !$response ) { |
190 | | - wfDebugLog( 'payflowpro_gateway', 'Failed communicating with reCaptcha: ' . curl_error( $ch ) ); |
| 190 | + PayflowProGateway::log( 'Failed communicating with reCaptcha: ' . curl_error( $ch ) ); |
191 | 191 | $response = "true\r\n\r\nsuccess"; |
192 | 192 | } |
193 | 193 | |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php |
— | — | @@ -139,6 +139,13 @@ |
140 | 140 | $wgPayflowAllowedHtmlForms = array( $wgPayflowHtmlFormDir . "/demo.html" ); |
141 | 141 | |
142 | 142 | /** |
| 143 | + * Configure PayflowproGateway to use syslog for log messages rather than wfDebugLog |
| 144 | + * |
| 145 | + * @var bool |
| 146 | + */ |
| 147 | +$wgPayflowGatewayUseSyslog = false; |
| 148 | + |
| 149 | +/** |
143 | 150 | * Hooks required to interface with the donation extension (include <donate> on page) |
144 | 151 | * |
145 | 152 | * gwValue supplies the value of the form option, the name that appears on the form |