*/
public static function commonCompose(&$form) {
//get the tokens.
- $tokens = CRM_Core_SelectValues::contactTokens();
+ $tokens = array();
- $className = CRM_Utils_System::getClassName($form);
- if ($className == 'CRM_Mailing_Form_Upload') {
- $tokens = array_merge(CRM_Core_SelectValues::mailingTokens(), $tokens);
- }
- elseif ($className == 'CRM_Admin_Form_ScheduleReminders') {
- $tokens = array_merge(CRM_Core_SelectValues::activityTokens(), $tokens);
- $tokens = array_merge(CRM_Core_SelectValues::eventTokens(), $tokens);
- $tokens = array_merge(CRM_Core_SelectValues::membershipTokens(), $tokens);
- }
- elseif ($className == 'CRM_Event_Form_ManageEvent_ScheduleReminders') {
- $tokens = array_merge(CRM_Core_SelectValues::eventTokens(), $tokens);
- }
-
- //TODO standardize on this method
if (method_exists($form, 'listTokens')) {
$tokens = array_merge($form->listTokens(), $tokens);
}
$textFields = array('text_message' => ts('HTML Format'), 'sms_text_message' => ts('SMS Message'));
$modePrefixes = array('Mail' => NULL, 'SMS' => 'SMS');
+ $className = CRM_Utils_System::getClassName($form);
+
if ($className != 'CRM_SMS_Form_Upload' && $className != 'CRM_Contact_Form_Task_SMS' &&
$className != 'CRM_Contact_Form_Task_SMS'
) {
// CRM-8460
$gotCronLock = FALSE;
- if (property_exists($config, 'mailerJobsMax') && $config->mailerJobsMax && $config->mailerJobsMax > 1) {
+ if (property_exists($config, 'mailerJobsMax') && $config->mailerJobsMax && $config->mailerJobsMax > 0) {
$lockArray = range(1, $config->mailerJobsMax);
shuffle($lockArray);
// check if we are using global locks
- $serverWideLock = CRM_Core_BAO_Setting::getItem(
- CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
- 'civimail_server_wide_lock'
- );
foreach ($lockArray as $lockID) {
- $cronLock = new CRM_Core_Lock("civimail.cronjob.{$lockID}", NULL, $serverWideLock);
+ $cronLock = Civi\Core\Container::singleton()->get('lockManager')->acquire("worker.mailing.send.{$lockID}");
if ($cronLock->isAcquired()) {
$gotCronLock = TRUE;
break;
CRM_Core_Error::debug_log_message('Returning early, since max number of cronjobs running');
return TRUE;
}
+
+ if (getenv('CIVICRM_CRON_HOLD')) {
+ // In testing, we may need to simulate some slow activities.
+ sleep(getenv('CIVICRM_CRON_HOLD'));
+ }
}
// load bootstrap to call hooks