r75813 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75812‎ | r75813 | r75814 >
Date:18:56, 1 November 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
Added additional logging; temporarily commenting out wmf_owa_queue2civicrm_import to prevent dbl updating of contribution
Modified paths:
  • /civicrm/trunk/sites/all/modules/wmf_owa/wmf_owa.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/wmf_owa/wmf_owa.module
@@ -52,10 +52,11 @@
5353 */
5454 function wmf_owa_civicrm_post( $op, $objectName, $objectId, &$objectRef ) {
5555 // only continue if we're handling an updated contribution
56 - if ( $objectName != 'Contribution' && !in_array( $op, array( 'edit' )) ) {
 56+ if ( $objectName != 'Contribution' || ( $objectName == 'Contribution' && $op != 'edit' ) ) {
5757 return;
5858 }
5959
 60+ watchdog( 'wmf_owa', 'Inside wmf_owa_civicrm_post with op: %op, object name: %obj_name', array( '%op' => $op, '%obj_name' => $objectName ), WATCHDOG_DEBUG );
6061 // load the OWA-specific tracking data
6162 $contrib_tracking_data = wmf_owa_get_contribution_tracking_data( $objectId );
6263 if ( !$contrib_tracking_data ) {
@@ -80,7 +81,9 @@
8182 * @param $contribution_id
8283 */
8384 function wmf_owa_queue2civicrm_import( $contribution_id ) {
84 - // load the OWA-specific tracking data
 85+
 86+//commenting this out for now because the contribution gets 'edited' when the thank you is sent
 87+/* // load the OWA-specific tracking data
8588 $contrib_tracking_data = wmf_owa_get_contribution_tracking_data( $contribution_id );
8689 if ( !$contrib_tracking_data ) {
8790 // log, don't post to OWA
@@ -105,7 +108,7 @@
106109 $query_params = wmf_owa_prepare_owa_query( $contrib_tracking_data, (object) $contribution );
107110
108111 // send the query to OWA
109 - wmf_owa_send_tracking( $query_params );
 112+ wmf_owa_send_tracking( $query_params );*/
110113 return;
111114 }
112115
@@ -155,7 +158,11 @@
156159 "owa_page_url" => $contrib_tracking_obj->url,
157160 "owa_session_id"=> $contrib_tracking_obj->owa_session,
158161 );
159 -
 162+
 163+ foreach ( $query_params as $key => $value ) {
 164+ if ( !strlen( (string) $value ) ) $query_params[ $key ] = 'none';
 165+ }
 166+
160167 // log the query params
161168 watchdog( 'wmf_owa',
162169 'OWA tracking params for contribution_id %objectId: %query_params',
@@ -195,8 +202,10 @@
196203 */
197204 function wmf_owa_send_tracking( $query_params ) {
198205 $owa_log_url = variable_get( 'wmf_owa_log', OWA_LOG_DEFAULT );
 206+ $url_with_request = $owa_log_url . "?" . http_build_query( $query_params, '', '&' );
 207+ watchdog( 'wmf_owa', 'Full url with request: %url', array( '%url' => $url_with_request ), WATCHDOG_DEBUG );
199208 $ch = curl_init();
200 - curl_setopt( $ch, CURLOPT_URL, $owa_log_url . "?". http_build_query( $query_params ));
 209+ curl_setopt( $ch, CURLOPT_URL, $url_with_request );
201210 curl_setopt( $ch, CURLOPT_USERAGENT, "WMF Ecommerce web service 1.0" );
202211 curl_setopt( $ch, CURLINFO_HEADER_OUT, true ); // so we can track the request header
203212
@@ -218,5 +227,6 @@
219228 WATCHDOG_DEBUG );
220229
221230 curl_close( $ch );
 231+// system( "wget --user-agent='WMF Ecommerce web service 1.0' '$url_with_request'" );
222232 return;
223233 }

Status & tagging log