From 988689cccc85587160bc2c37d0a5101c1991f9c3 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 15 Aug 2015 04:45:54 -0700 Subject: [PATCH] CRM-16373 - settings - Declare mailer settings Conflicts: settings/Mailing.setting.php --- CRM/Admin/Form/Setting/Mail.php | 14 ++--- CRM/Mailing/Config.php | 50 ---------------- settings/Mailing.setting.php | 100 ++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 59 deletions(-) diff --git a/CRM/Admin/Form/Setting/Mail.php b/CRM/Admin/Form/Setting/Mail.php index e78d5daf4f..b6e5237d5d 100644 --- a/CRM/Admin/Form/Setting/Mail.php +++ b/CRM/Admin/Form/Setting/Mail.php @@ -38,6 +38,11 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting { protected $_settings = array( 'replyTo' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, + 'mailerBatchLimit' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, + 'mailerJobSize' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, + 'mailerJobsMax' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, + 'mailThrottleTime' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, + 'verpSeparator' => CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, ); /** @@ -45,11 +50,6 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting { */ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Settings - CiviMail')); - $this->addElement('text', 'verpSeparator', ts('VERP Separator')); - $this->addElement('text', 'mailerBatchLimit', ts('Mailer Batch Limit')); - $this->addElement('text', 'mailThrottleTime', ts('Mailer Throttle Time')); - $this->addElement('text', 'mailerJobSize', ts('Mailer Job Size')); - $this->addElement('text', 'mailerJobsMax', ts('Mailer CRON job limit')); $check = TRUE; // redirect to Administer Section After hitting either Save or Cancel button. @@ -57,10 +57,6 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting { $session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); $this->addFormRule(array('CRM_Admin_Form_Setting_Mail', 'formRule')); - $this->addRule('mailerBatchLimit', ts('Please enter a valid integer.'), 'integer'); - $this->addRule('mailThrottleTime', ts('Please enter a valid integer.'), 'integer'); - $this->addRule('mailerJobSize', ts('Please enter a valid integer.'), 'integer'); - $this->addRule('mailerJobsMax', ts('Please enter a valid integer.'), 'integer'); parent::buildQuickForm($check); } diff --git a/CRM/Mailing/Config.php b/CRM/Mailing/Config.php index 23d0931dd5..30808a4bbd 100644 --- a/CRM/Mailing/Config.php +++ b/CRM/Mailing/Config.php @@ -41,54 +41,4 @@ class CRM_Mailing_Config extends CRM_Core_Component_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; - /** - * What should be the verp separator we use. - * - * @var char - */ - public $verpSeparator = '.'; - - /** - * How long should we wait before checking for new outgoing mailings? - * - * @var int - */ - public $mailerPeriod = 180; - - /** - * TODO - * - * @var int - */ - public $mailerSpoolLimit = 0; - - /** - * How many emails should CiviMail deliver on a given run - * - * @var int - */ - public $mailerBatchLimit = 0; - - /** - * How large should each mail thread be - * - * @var int - */ - public $mailerJobSize = 0; - - /** - * How many parallel delivery cron jobs should we run - * - * @var int - */ - public $mailerJobsMax = 0; - - /** - * Should we sleep after sending an email? - * Setting this to 0 means no sleep - * - * @var int - */ - public $mailThrottleTime = 0; - } diff --git a/settings/Mailing.setting.php b/settings/Mailing.setting.php index ccab6e9467..4e999a2293 100644 --- a/settings/Mailing.setting.php +++ b/settings/Mailing.setting.php @@ -206,4 +206,104 @@ return array( 'description' => '', 'help_text' => NULL, ), + 'mailerBatchLimit' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'mailerBatchLimit', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 4, + 'maxlength' => 8, + ), + 'default' => 0, + 'add' => '4.7', + 'title' => 'Mailer Batch Limit', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Throttle email delivery by setting the maximum number of emails sent during each CiviMail run (0 = unlimited).', + 'help_text' => NULL, + 'prefetch' => 1, + ), + 'mailerJobSize' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'mailerJobSize', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 4, + 'maxlength' => 8, + ), + 'default' => 0, + 'add' => '4.7', + 'title' => 'Mailer Job Size', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If you want to utilize multi-threading enter the size you want your sub jobs to be split into. Recommended values are between 1,000 and 10,000. Use a lower value if your server has multiple cron jobs running simultaneously, but do not use values smaller than 1,000. Enter "0" to disable multi-threading and process mail as one single job - batch limits still apply.', + 'help_text' => NULL, + 'prefetch' => 1, + ), + 'mailerJobsMax' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'mailerJobsMax', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 4, + 'maxlength' => 8, + ), + 'default' => 0, + 'add' => '4.7', + 'title' => 'Mailer Cron Job Limit', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'The maximum number of mailer delivery jobs executing simultaneously (0 = allow as many processes to execute as started by cron)', + 'help_text' => NULL, + 'prefetch' => 1, + ), + 'mailThrottleTime' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'mailThrottleTime', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 4, + 'maxlength' => 8, + ), + 'default' => 0, + 'add' => '4.7', + 'title' => 'Mailer Throttle Time', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'The time to sleep in between each e-mail in micro seconds. Setting this above 0 allows you to control the rate at which e-mail messages are sent to the mail server, avoiding filling up the mail queue very quickly. Set to 0 to disable.', + 'help_text' => NULL, + 'prefetch' => 1, + ), + 'verpSeparator' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'verpSeparator', + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 4, + 'maxlength' => 32, + ), + 'default' => '.', + 'add' => '4.7', + 'title' => 'VERP Separator', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Separator character used when CiviMail generates VERP (variable envelope return path) Mail-From addresses.', + 'help_text' => NULL, + 'prefetch' => 1, + ), ); -- 2.25.1