Index: branches/5.2.x/core/units/mailing_lists/mailing_list_eh.php =================================================================== diff -u -r16513 -r16598 --- branches/5.2.x/core/units/mailing_lists/mailing_list_eh.php (.../mailing_list_eh.php) (revision 16513) +++ branches/5.2.x/core/units/mailing_lists/mailing_list_eh.php (.../mailing_list_eh.php) (revision 16598) @@ -1,6 +1,6 @@ Array ('self' => 'edit'), 'OnGenerateEmailQueue' => Array ('self' => true), - 'OnProcessEmailQueue' => Array ('self' => true), 'OnGetHtmlBody' => Array ('self' => 'edit'), ); @@ -255,28 +254,6 @@ } /** - * Allows to safely get mailing configuration variables - * - * @param string $variable_name - * @return int - */ - function _ensureDefault($variable_name) - { - $value = $this->Application->ConfigValue($variable_name); - if ( $value === false ) { - // ensure default value, when configuration variable is missing - return 10; - } - - if ( !$value ) { - // configuration variable found, but it's value is empty or zero - return false; - } - - return $value; - } - - /** * Generates email queue for active mailing lists * * @param kEvent $event @@ -302,16 +279,15 @@ return; } - // queue 10 emails per step summary from all mailing lists (FIFO logic) - $to_queue = $this->_ensureDefault('MailingListQueuePerStep'); + /** @var MailingListHelper $mailing_list_helper */ + $mailing_list_helper = $this->Application->recallObject('MailingListHelper'); - if ( $to_queue === false ) { + $to_queue = $mailing_list_helper->getSetting('MailingListQueuePerStep'); + + if ( !is_numeric($to_queue) ) { return; } - /** @var MailingListHelper $mailing_list_helper */ - $mailing_list_helper = $this->Application->recallObject('MailingListHelper'); - foreach ($mailing_lists as $mailing_id => $mailing_data) { if ( $mailing_data['EmailsTotal'] == 0 ) { // no work performed on this mailing list -> calculate totals @@ -356,38 +332,6 @@ } /** - * Process email queue from cron - * - * @param kEvent $event - */ - function OnProcessEmailQueue($event) - { - $deliver_count = $this->_ensureDefault('MailingListSendPerStep'); - if ($deliver_count === false) { - return ; - } - - $queue_table = $this->Application->getUnitOption('email-queue', 'TableName'); - - // get queue part to send - $sql = 'SELECT * - FROM ' . $queue_table . ' - WHERE (SendRetries < 5) AND (LastSendRetry < ' . strtotime('-2 hours') . ') - LIMIT 0,' . $deliver_count; - $messages = $this->Conn->Query($sql); - - if (!$messages) { - // no more messages left in queue - return ; - } - - /** @var MailingListHelper $mailing_list_helper */ - $mailing_list_helper = $this->Application->recallObject('MailingListHelper'); - - $mailing_list_helper->processQueue($messages); - } - - /** * Returns HTML of sent e-mail for iframe * * @param kEvent $event @@ -403,4 +347,4 @@ echo $object->GetDBField('MessageHtml'); } - } \ No newline at end of file + }