Eileen has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/368940 )
Change subject: Make mailing get process skip on exception.
......................................................................
Make mailing get process skip on exception.
There were a couple of mailings we could not retrieve, Caitlin checked & they
were deleted.
It seems we should quietly contine past errors rather than let them crash the
script
Bug: T171433
Change-Id: I6fff886a6070d33ad26f091afc3440c6833094bf
---
M
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Get.php
1 file changed, 31 insertions(+), 25 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/40/368940/1
diff --git
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Get.php
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Get.php
index c4dd313..ad408ee 100644
---
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Get.php
+++
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Get.php
@@ -28,34 +28,40 @@
$mailings = $mailer->getMailings($mailerParameters)->getResponse();
$results = array();
foreach ($mailings as $mailing) {
- $result = array(
- 'subject' => $mailing->getSubject(),
- 'external_identifier' => $mailing->getMailingIdentifier(),
- 'name' => $mailing->getName(),
- 'scheduled_date' => $mailing->getScheduledDate(),
- 'start_date' => $mailing->getSendStartDate(),
- 'number_sent' => $mailing->getNumberSent(),
- 'body_html' => $mailing->getHtmlBody(),
- 'body_text' => $mailing->getTextBody(),
- 'number_bounced' => $mailing->getNumberBounces(),
- 'number_opened_total' => $mailing->getNumberOpens(),
- 'number_opened_unique' => $mailing->getNumberUniqueOpens(),
- 'number_unsubscribed' => $mailing->getNumberUnsubscribes(),
- 'number_suppressed' => $mailing->getNumberSuppressedByProvider(),
- // 'forwarded'
- 'number_blocked' => $mailing->getNumberBlocked(),
- // 'clicked_total' => $stats['NumGrossClick'],
- 'number_abuse_complaints' => $mailing->getNumberAbuseReports(),
- );
+ try {
+ $result = array(
+ 'subject' => $mailing->getSubject(),
+ 'external_identifier' => $mailing->getMailingIdentifier(),
+ 'name' => $mailing->getName(),
+ 'scheduled_date' => $mailing->getScheduledDate(),
+ 'start_date' => $mailing->getSendStartDate(),
+ 'number_sent' => $mailing->getNumberSent(),
+ 'body_html' => $mailing->getHtmlBody(),
+ 'body_text' => $mailing->getTextBody(),
+ 'number_bounced' => $mailing->getNumberBounces(),
+ 'number_opened_total' => $mailing->getNumberOpens(),
+ 'number_opened_unique' => $mailing->getNumberUniqueOpens(),
+ 'number_unsubscribed' => $mailing->getNumberUnsubscribes(),
+ 'number_suppressed' => $mailing->getNumberSuppressedByProvider(),
+ // 'forwarded'
+ 'number_blocked' => $mailing->getNumberBlocked(),
+ // 'clicked_total' => $stats['NumGrossClick'],
+ 'number_abuse_complaints' => $mailing->getNumberAbuseReports(),
+ );
- foreach ($result as $key => $value) {
- // Assuming we might change provider and they might not return
- // all the above, we unset any not returned.
- if ($value === NULL) {
- unset($result[$key]);
+ foreach ($result as $key => $value) {
+ // Assuming we might change provider and they might not return
+ // all the above, we unset any not returned.
+ if ($value === NULL) {
+ unset($result[$key]);
+ }
}
+ $results[] = $result;
}
- $results[] = $result;
+ catch (Exception $e) {
+ // Continue. It seems we sometimes get back deleted emails which
+ // should not derail the process.
+ }
}
return civicrm_api3_create_success($results);
}
--
To view, visit https://gerrit.wikimedia.org/r/368940
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fff886a6070d33ad26f091afc3440c6833094bf
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits