Page MenuHomeIn-Portal Phabricator

D313.id810.diff
No OneTemporary

File Metadata

Created
Wed, Feb 26, 9:04 AM

D313.id810.diff

Index: branches/5.3.x/core/kernel/utility/email.php
===================================================================
--- branches/5.3.x/core/kernel/utility/email.php
+++ branches/5.3.x/core/kernel/utility/email.php
@@ -229,11 +229,12 @@
/**
* Sends e-mail now or puts it in queue
*
- * @param int $recipient_user_id
- * @return bool
- * @access public
+ * @param integer $recipient_user_id Recipient user id.
+ * @param boolean $immediate_send Immediate send.
+ *
+ * @return boolean
*/
- public function send($recipient_user_id = null)
+ public function send($recipient_user_id = null, $immediate_send = null)
{
$this->recipientUserId = $recipient_user_id;
@@ -309,9 +310,18 @@
$this->sender->setLogData($this->logData);
}
- $delivery = isset($this->params['delivery']) ? $this->params['delivery'] : $this->Application->ConfigValue('EmailDelivery');
+ if ( !isset($immediate_send) ) {
+ if ( isset($this->params['delivery']) ) {
+ $delivery = $this->params['delivery'];
+ }
+ else {
+ $delivery = $this->Application->ConfigValue('EmailDelivery');
+ }
+
+ $immediate_send = $delivery == EmailDelivery::IMMEDIATE;
+ }
- return $this->sender->Deliver(null, $delivery == EmailDelivery::IMMEDIATE);
+ return $this->sender->Deliver(null, $immediate_send);
}
/**
Index: branches/5.3.x/core/units/email_templates/email_template_eh.php
===================================================================
--- branches/5.3.x/core/units/email_templates/email_template_eh.php
+++ branches/5.3.x/core/units/email_templates/email_template_eh.php
@@ -30,6 +30,7 @@
$permissions = Array (
'OnFrontOnly' => Array ('self' => 'edit'),
'OnSaveSelected' => Array ('self' => 'view'),
+ 'OnProcessEmailQueue' => Array ('self' => 'add|edit'),
'OnExportEmailTemplates' => Array ('self' => 'view'),
'OnSuggestAddressJSON' => Array ('self' => 'add|edit'),
@@ -217,6 +218,22 @@
}
/**
+ * [AJAX] Process emails from queue.
+ *
+ * @param kEvent $event Event.
+ *
+ * @return void
+ * @deprecated 5.3.0-B1
+ * @see EmailQueueEventHandler::OnProcessAjax()
+ */
+ function OnProcessEmailQueue($event)
+ {
+ kUtil::deprecatedMethod(__METHOD__, '5.3.0-B1', 'EmailQueueEventHandler::OnProcessAjax');
+
+ $event->CallSubEvent('email-queue:OnProcessAjax');
+ }
+
+ /**
* Prefills module dropdown
*
* @param kEvent $event
Index: branches/5.3.x/core/units/helpers/mailing_list_helper.php
===================================================================
--- branches/5.3.x/core/units/helpers/mailing_list_helper.php
+++ branches/5.3.x/core/units/helpers/mailing_list_helper.php
@@ -270,14 +270,22 @@
/**
* Sent given messages from email queue.
*
+ * @param array|null $messages Messages.
+ *
* @return integer
*/
- function processQueue()
+ function processQueue(&$messages = null)
{
/** @var kEmailSendingHelper $esender */
$esender = $this->Application->recallObject('EmailSender');
- $messages = $this->getMessages();
+ if ( !isset($messages) ) {
+ $messages = $this->getMessages();
+ }
+ else {
+ kUtil::deprecatedArgument(__METHOD__, '5.3.0-B1', 'The "$messages" parameter is deprecated.');
+ }
+
$message_count = count($messages);
if ( !$message_count ) {
@@ -383,4 +391,4 @@
return $value;
}
- }
\ No newline at end of file
+ }
Index: branches/5.3.x/core/units/mailing_lists/mailing_list_eh.php
===================================================================
--- branches/5.3.x/core/units/mailing_lists/mailing_list_eh.php
+++ branches/5.3.x/core/units/mailing_lists/mailing_list_eh.php
@@ -30,6 +30,7 @@
$permissions = Array (
'OnCancelMailing' => Array ('self' => 'edit'),
'OnGenerateEmailQueue' => Array ('self' => true),
+ 'OnProcessEmailQueue' => Array ('self' => true),
'OnGetHtmlBody' => Array ('self' => 'edit'),
);
@@ -254,6 +255,25 @@
}
/**
+ * Allows to safely get mailing configuration variables
+ *
+ * @param string $variable_name Variable name.
+ *
+ * @return integer
+ * @deprecated 5.3.0-B1
+ * @see MailingListHelper::getSetting()
+ */
+ function _ensureDefault($variable_name)
+ {
+ kUtil::deprecatedMethod(__METHOD__, '5.3.0-B1', 'MailingListHelper::getSetting');
+
+ /** @var MailingListHelper $mailing_list_helper */
+ $mailing_list_helper = $this->Application->recallObject('MailingListHelper');
+
+ return $mailing_list_helper->getSetting($variable_name);
+ }
+
+ /**
* Generates email queue for active mailing lists
*
* @param kEvent $event
@@ -333,6 +353,22 @@
}
/**
+ * [SCHEDULED TASK] Process email queue from cron
+ *
+ * @param kEvent $event Event.
+ *
+ * @return void
+ * @deprecated 5.3.0-B1
+ * @see EmailQueueEventHandler::OnProcess()
+ */
+ function OnProcessEmailQueue($event)
+ {
+ kUtil::deprecatedMethod(__METHOD__, '5.3.0-B1', 'EmailQueueEventHandler::OnProcess');
+
+ $event->CallSubEvent('email-queue:OnProcess');
+ }
+
+ /**
* Returns HTML of sent e-mail for iframe
*
* @param kEvent $event

Event Timeline