r79979 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79978‎ | r79979 | r79980 >
Date:00:03, 11 January 2011
Author:awjrichards
Status:deferred
Tags:
Comment:
Updated watchdog calls to use proper syntax
Modified paths:
  • /civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm_common.inc (modified) (history)
  • /civicrm/trunk/sites/all/modules/queue2civicrm/recurring/recurring.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/queue2civicrm/recurring/recurring.module
@@ -192,7 +192,7 @@
193193 } elseif ( isset( $msg[ 'txn_type' ] ) && in_array( $msg[ 'txn_type' ], $txn_subscr_acct ) ) {
194194 $ret_val = recurring_import_subscr_acct( $msg );
195195 } else {
196 - watchdog( 'recurring', 'Msg not recognized as a recurring payment related message.', WATCHDOG_NOTICE );
 196+ watchdog( 'recurring', 'Msg not recognized as a recurring payment related message.' );
197197 $ret_val = 0;
198198 }
199199
@@ -215,10 +215,10 @@
216216 * otherwise, process the payment.
217217 */
218218 if ( !isset( $msg[ 'subscr_id' ] ) ) {
219 - watchdog( 'recurring', 'Msg missing the subscr_id; cannot process.', WATCHDOG_NOTICE );
 219+ watchdog( 'recurring', 'Msg missing the subscr_id; cannot process.');
220220 return 0;
221221 } elseif ( !$recur_record = recurring_get_recur_record( $msg[ 'subscr_id' ] ) ) { // check for parent record in civicrm_contribution_recur and fetch its id
222 - watchdog( 'recurring', 'Msg does not have a matching recurring record in civicrm_contribution_recur; requeueing for future processing.', WATCHDOG_NOTICE );
 222+ watchdog( 'recurring', 'Msg does not have a matching recurring record in civicrm_contribution_recur; requeueing for future processing.' );
223223 return 2;
224224 }
225225
@@ -292,7 +292,7 @@
293293 break;
294294
295295 default:
296 - watchdog( 'recurring', 'Invalid subscription message type.', print_r( $msg, true ), WATCHDOG_NOTICE );
 296+ watchdog( 'recurring', 'Invalid subscription message type: %msg', array( '%msg' => print_r( $msg, true )), WATCHDOG_NOTICE );
297297 $ret_val = 0;
298298 break;
299299 }
@@ -309,7 +309,7 @@
310310 function recurring_import_subscr_signup( $msg ) {
311311 // ensure there is not already a record of this account - if so, mark the message as succesfuly processed
312312 if ( $recur_record = recurring_get_recur_record( $msg[ 'subscr_id' ] ) ) {
313 - watchdog( 'recurring', 'Subscription account already exists', print_r( $msg, true ), WATCHDOG_NOTICE );
 313+ watchdog( 'recurring', 'Subscription account already exists: %msg', array( '%msg' => print_r( $msg, true )), WATCHDOG_NOTICE );
314314 return 1;
315315 }
316316
@@ -348,10 +348,10 @@
349349 );
350350
351351 if ( !$result ) {
352 - watchdog( 'recurring', 'Failed inserting subscriber signup for subscriber id ', print_r( $msg['subscr_id'], true), WATCHDOG_NOTICE );
 352+ watchdog( 'recurring', 'Failed inserting subscriber signup for subscriber id: %subscr_id', array( '%subscr_id' => print_r( $msg['subscr_id'], true )), WATCHDOG_NOTICE );
353353 return 0;
354354 } else {
355 - watchdog( 'recurring', 'Succesfully inserted subscription signup for subscriber id ', print_r( $msg[ 'subscr_id' ], true), WATCHDOG_NOTICE );
 355+ watchdog( 'recurring', 'Succesfully inserted subscription signup for subscriber id: %subscr_id ', array( '%subscr_id' => print_r( $msg[ 'subscr_id' ], true )), WATCHDOG_NOTICE );
356356 return 1;
357357 }
358358 }
@@ -365,17 +365,17 @@
366366 function recurring_import_subscr_cancel( $msg ) {
367367 // ensure we have a record of the subscription
368368 if ( !$recur_record = recurring_get_recur_record( $msg[ 'subscr_id' ] ) ) {
369 - watchdog( 'recurring', 'Subscription account does not exist', print_r( $msg, true ), WATCHDOG_NOTICE );
 369+ watchdog( 'recurring', 'Subscription account does not exist: %msg', array( '%msg' => print_r( $msg, true )), WATCHDOG_NOTICE );
370370 return 2;
371371 }
372372
373373 $query = "UPDATE {civicrm.civicrm_contribution_recur} SET cancel_date='%s', end_date='%s' WHERE trxn_id=%d";
374374 $result = db_query( $query, $msg[ 'cancel_date' ], $msg[ 'end_date' ], $msg[ 'subscr_id' ] );
375375 if ( !$result ) {
376 - watchdog( 'recurring', 'There was a problem updating the subscription for cancelation for subscriber id ', print_r( $msg[ 'subscr_id' ], true ), WATCHDOG_NOTICE );
 376+ watchdog( 'recurring', 'There was a problem updating the subscription for cancelation for subscriber id: %subscr_id', array( '%subscr_id' => print_r( $msg[ 'subscr_id' ], true )), WATCHDOG_NOTICE );
377377 return 0;
378378 } else {
379 - watchdog( 'recurring', 'Succesfuly cacneled subscription for subscriber id ', print_r( $msg[ 'subsr_id' ], true ), WATCHDOG_NOTICE );
 379+ watchdog( 'recurring', 'Succesfuly cacneled subscription for subscriber id %subscr_id', array( '%subscr_id' => print_r( $msg[ 'subsr_id' ], true )), WATCHDOG_NOTICE );
380380 return 1;
381381 }
382382 }
@@ -389,17 +389,17 @@
390390 function recurring_import_subscr_eot( $msg ) {
391391 // ensure we have a record of the subscription
392392 if ( !$recur_record = recurring_get_recur_record( $msg[ 'subscr_id' ] ) ) {
393 - watchdog( 'recurring', 'Subscription account does not exist', print_r( $msg, true ), WATCHDOG_NOTICE );
 393+ watchdog( 'recurring', 'Subscription account does not exist: %msg', array( '%msg' => print_r( $msg, true )), WATCHDOG_NOTICE );
394394 return 2;
395395 }
396396
397397 $query = "UPDATE {civicrm.civicrm_contribution_recur} SET end_date='%s' WHERE trxn_id=%d";
398398 $result = db_query( $query, $msg[ 'end_date' ], $msg[ 'subscr_id' ] );
399399 if ( !$result ) {
400 - watchdog( 'recurring', 'There was a problem updating the subscription for EOT ', print_r( $msg[ 'subscr_id' ], true ), WATCHDOG_NOTICE );
 400+ watchdog( 'recurring', 'There was a problem updating the subscription for EOT for subscription id: %subscr_id', array( '%subscr_id' => print_r( $msg[ 'subscr_id' ], true )), WATCHDOG_NOTICE );
401401 return 0;
402402 } else {
403 - watchdog( 'recurring', 'Succesfuly ended subscription for subscriber id ', print_r( $msg[ 'subsr_id' ], true ), WATCHDOG_NOTICE );
 403+ watchdog( 'recurring', 'Succesfuly ended subscription for subscriber id: %subscr_id ', array( '%subscr_id' => print_r( $msg[ 'subsr_id' ], true )), WATCHDOG_NOTICE );
404404 return 1;
405405 }
406406 }
@@ -413,7 +413,7 @@
414414 function recurring_import_subscr_modify( $msg ) {
415415 // ensure we have a record of the subscription
416416 if ( !$recur_record = recurring_get_recur_record( $msg[ 'subscr_id' ] ) ) {
417 - watchdog( 'recurring', 'Subscription account does not exist', print_r( $msg, true ), WATCHDOG_NOTICE );
 417+ watchdog( 'recurring', 'Subscription account does not exist for subscription id: %subscr_id', array( '%subscr_id' => print_r( $msg, true )), WATCHDOG_NOTICE );
418418 return 2;
419419 }
420420
@@ -451,7 +451,7 @@
452452 // Tag contact for review
453453 $tag = _queu2civicrm_tag_insert( $contact );
454454
455 - watchdog( 'recurring', 'Subscription succesfully modified for subscription id ', print_r( $msg['subscr_id'], true ), WATCHDOG_NOTICE );
 455+ watchdog( 'recurring', 'Subscription succesfully modified for subscription id: %subscr_id', array( '%subscr_id' => print_r( $msg['subscr_id'], true )), WATCHDOG_NOTICE );
456456 return 1;
457457 }
458458
@@ -463,17 +463,17 @@
464464 function recurring_import_subscr_failed( $msg ) {
465465 // ensure we have a record of the subscription
466466 if ( !$recur_record = recurring_get_recur_record( $msg[ 'subscr_id' ] ) ) {
467 - watchdog( 'recurring', 'Subscription account does not exist', print_r( $msg, true ), WATCHDOG_NOTICE );
 467+ watchdog( 'recurring', 'Subscription account does not exist for subscription: %subscription', array( "%subscription" => print_r( $msg, true )), WATCHDOG_NOTICE );
468468 return 2;
469469 }
470470
471471 $query = "UPDATE {civicrm.civicrm_contribution_recur} SET failure_count=%d, failure_retry_date='%s' WHERE trxn_id=%d";
472472 $result = db_query( $query, $msg[ 'failure_count' ], $msg[ 'failure_retery_date' ], $msg[ 'subscr_id' ] );
473473 if ( !$result ) {
474 - watchdog( 'recurring', 'There was a problem updating the subscription for failed payment for subscriber id ', print_r( $msg[ 'subscr_id' ], true ), WATCHDOG_NOTICE );
 474+ watchdog( 'recurring', 'There was a problem updating the subscription for failed payment for subscriber id: %subscr_id ', array( '%subscr_id' => print_r( $msg[ 'subscr_id' ], true )), WATCHDOG_NOTICE );
475475 return 0;
476476 } else {
477 - watchdog( 'recurring', 'Succesfuly cacneled subscription for failed payment for subscriber id ', print_r( $msg[ 'subsr_id' ], true ), WATCHDOG_NOTICE );
 477+ watchdog( 'recurring', 'Succesfuly cacneled subscription for failed payment for subscriber id: %subscr_id ', array( '%subscr_id' => print_r( $msg[ 'subsr_id' ], true )), WATCHDOG_NOTICE );
478478 return 1;
479479 }
480480 }
@@ -486,7 +486,7 @@
487487 function recurring_get_recur_record( $subscr_id ) {
488488 $query = "SELECT * FROM civicrm.civicrm_contribution_recur WHERE trxn_id = %d";
489489 $recur_record = db_fetch_object( db_query( $query, $subscr_id ) );
490 - watchdog( 'recurring', 'Recurring record: ', print_r( $recur_record, true ), WATCHDOG_DEBUG );
 490+ watchdog( 'recurring', 'Recurring record: %recur_record', array( '%recur_record' => print_r( $recur_record, true )), WATCHDOG_DEBUG );
491491 return $recur_record;
492492 }
493493
Index: civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm_common.inc
@@ -120,7 +120,7 @@
121121 $contact['display_name'] = trim($contact['first_name'] . ' ' . $contact['last_name']);
122122 $contact_result = &civicrm_contact_add( $contact );
123123
124 - watchdog( 'queue2civicrm', 'Result for adding contact: ', print_r( $contact_result, true ), WATCHDOG_DEBUG );
 124+ watchdog( 'queue2civicrm', 'Result for adding contact: %contact', array( '%contact' => print_r( $contact_result, true )), WATCHDOG_DEBUG );
125125
126126 return $contact_result;
127127 }
@@ -183,7 +183,7 @@
184184 'email' => $msg['email']
185185 );
186186 $location_result = &civicrm_location_add( $address );
187 - watchdog( 'queue2civicrm', 'Result for adding location: ', print_r( $location_result, true ), WATCHDOG_DEBUG );
 187+ watchdog( 'queue2civicrm', 'Result for adding location: %location', array( '%location' => print_r( $location_result, true )), WATCHDOG_DEBUG );
188188 return $location_result;
189189 }
190190

Status & tagging log