From dfb542fc9d0936dbf62c4d04fa743a122436dd02 Mon Sep 17 00:00:00 2001 From: JKingsnorth Date: Thu, 26 Nov 2015 15:45:43 +0000 Subject: [PATCH] CRM-17626 Move BULK_MAIL_INSERT_COUNT --- CRM/Core/DAO.php | 4 ---- CRM/Mailing/BAO/MailingJob.php | 4 ++-- CRM/Mailing/Config.php | 5 +++++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 335a3fd50c..2f268a5265 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -54,10 +54,6 @@ class CRM_Core_DAO extends DB_DataObject { VALUE_SEPARATOR = "", BULK_INSERT_COUNT = 200, BULK_INSERT_HIGH_COUNT = 200, - // special value for mail bulk inserts to avoid - // potential duplication, assuming a smaller number reduces number of queries - // by some factor, so some tradeoff. CRM-8678 - BULK_MAIL_INSERT_COUNT = 10, QUERY_FORMAT_WILDCARD = 1, QUERY_FORMAT_NO_QUOTES = 2; diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 998e046a61..9a9bf55e11 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -454,7 +454,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) $recipients->phone_id, ); $count++; - if ($count % CRM_Core_DAO::BULK_MAIL_INSERT_COUNT == 0) { + if ($count % CRM_Mailing_Config::BULK_MAIL_INSERT_COUNT == 0) { CRM_Mailing_Event_BAO_Queue::bulkCreate($params, $now); $count = 0; $params = array(); @@ -757,7 +757,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) $targetParams[] = $field['contact_id']; $count++; - if ($count % CRM_Core_DAO::BULK_MAIL_INSERT_COUNT == 0) { + if ($count % CRM_Mailing_Config::BULK_MAIL_INSERT_COUNT == 0) { $this->writeToDB( $deliveredParams, $targetParams, diff --git a/CRM/Mailing/Config.php b/CRM/Mailing/Config.php index 26c6a2ecf7..191a37740e 100644 --- a/CRM/Mailing/Config.php +++ b/CRM/Mailing/Config.php @@ -39,4 +39,9 @@ class CRM_Mailing_Config { const OUTBOUND_OPTION_MOCK = 4; // seems to be the same as 2, but also calls Mail's pre/post hooks? - see packages/Mail const OUTBOUND_OPTION_REDIRECT_TO_DB = 5; + // special value for mail bulk inserts to avoid + // potential duplication, assuming a smaller number reduces number of queries + // by some factor, so some tradeoff. CRM-8678 + const BULK_MAIL_INSERT_COUNT = 10; + } -- 2.25.1