Katie Horn has uploaded a new change for review.
https://gerrit.wikimedia.org/r/163965
Change subject: Small cleanup round for the WP audit script * Forgot to take
into account that testers are going to do strange things with the UTM data *
Cleaned up a couple calls to functions that don't actually exist
......................................................................
Small cleanup round for the WP audit script
* Forgot to take into account that testers are going to do strange
things with the UTM data
* Cleaned up a couple calls to functions that don't actually exist
Change-Id: Ie66d8b038a2718213060fbdd40ca9f46d6730fbe
---
M sites/all/modules/wmf_audit/wmf_audit.module
1 file changed, 21 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/65/163965/1
diff --git a/sites/all/modules/wmf_audit/wmf_audit.module
b/sites/all/modules/wmf_audit/wmf_audit.module
index af667a5..022843c 100644
--- a/sites/all/modules/wmf_audit/wmf_audit.module
+++ b/sites/all/modules/wmf_audit/wmf_audit.module
@@ -286,7 +286,7 @@
function wmf_audit_log_hunt_and_send($missing_by_date) {
if (empty($missing_by_date)) {
- wmf_audit_log(__FUNCTION__ . ': No missing transactions sent to this
function. Aborting.');
+ wmf_audit_echo(__FUNCTION__ . ': No missing transactions sent to this
function. Aborting.');
return false;
}
@@ -370,11 +370,14 @@
}
}
}
- wmf_audit_echo("Checking log $log_date for missing transactions that came
in with the following dates: " . print_r($display_dates, true));
+ $log = false;
+ if (!empty($display_dates)) {
+ wmf_audit_echo("Checking log $log_date for missing transactions that
came in with the following dates: " . print_r($display_dates, true));
- //now actually check the log from $log_date, for the missing transactions
in $tryme
- // Get the prepped log with the current date, returning false if it's not
there.
- $log = wmf_audit_get_log_by_date($log_date);
+ //now actually check the log from $log_date, for the missing
transactions in $tryme
+ // Get the prepped log with the current date, returning false if it's
not there.
+ $log = wmf_audit_get_log_by_date($log_date);
+ }
if ($log) {
//check to see if the missing transactions we're trying now, are in
there.
@@ -429,7 +432,11 @@
if (!$error) {
//Now that we've made it this far: Easy check to make sure
we're even looking at the right thing...
- if ((!wmf_audit_runtime_options('fakedb')) &&
($contribution_tracking_data['utm_payment_method'] !==
$all_data['payment_method'])) {
+ //I'm not totally sure this is going to be the right thing to
do, though. Intended fragility.
+ if ((!wmf_audit_runtime_options('fakedb')) &&
+
(!is_null($contribution_tracking_data['utm_payment_method'])) &&
+ ($contribution_tracking_data['utm_payment_method'] !==
$all_data['payment_method'])) {
+
$message = 'Payment method mismatch between utm tracking
data(' . $contribution_tracking_data['utm_payment_method'];
$message .= ') and normalized log and recon data(' .
$all_data['payment_method'] . '). Investigation required.';
$error = array(
@@ -750,7 +757,7 @@
*/
function wmf_audit_get_missing_transactions($transactions) {
if (empty($transactions)) {
- wmf_audit_log(__FUNCTION__ . ': No transactions to find. Returning.');
+ wmf_audit_echo(__FUNCTION__ . ': No transactions to find. Returning.');
return false;
}
//go through the transactions and check to see if they're in civi
@@ -1084,8 +1091,13 @@
//unfortunately, the queue consumer doesn't do anything like... look up utm
data if it's not there, but we have a ctid. So...
if ($result) {
- $utm_payment_method = explode('.', $result['utm_source']);
- $utm_payment_method = $utm_payment_method[2]; //...sure.
+ if (!is_null($result['utm_source'])) {
+ $utm_payment_method = explode('.', $result['utm_source']);
+ $utm_payment_method = $utm_payment_method[2]; //...sure.
+ } else {
+ //probably one of us silly people doing things in testing...
+ $utm_payment_method = NULL;
+ }
$idiotic_date_format = $result['ts'];
$real_timestamp = date_parse($idiotic_date_format);
--
To view, visit https://gerrit.wikimedia.org/r/163965
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie66d8b038a2718213060fbdd40ca9f46d6730fbe
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Katie Horn <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits