Index: branches/5.3.x/core/units/mailing_lists/mailing_list_eh.php =================================================================== diff -u -N -r15698 -r15916 --- branches/5.3.x/core/units/mailing_lists/mailing_list_eh.php (.../mailing_list_eh.php) (revision 15698) +++ branches/5.3.x/core/units/mailing_lists/mailing_list_eh.php (.../mailing_list_eh.php) (revision 15916) @@ -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 @@ -303,16 +280,15 @@ return; } - // queue 10 emails per step summary from all mailing lists (FIFO logic) - $to_queue = $this->_ensureDefault('MailingListQueuePerStep'); + $mailing_list_helper = $this->Application->recallObject('MailingListHelper'); + /* @var $mailing_list_helper MailingListHelper */ - if ( $to_queue === false ) { + $to_queue = $mailing_list_helper->getSetting('MailingListQueuePerStep'); + + if ( !is_numeric($to_queue) ) { return; } - $mailing_list_helper = $this->Application->recallObject('MailingListHelper'); - /* @var $mailing_list_helper MailingListHelper */ - foreach ($mailing_lists as $mailing_id => $mailing_data) { if ( $mailing_data['EmailsTotal'] == 0 ) { // no work performed on this mailing list -> calculate totals @@ -357,38 +333,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->getUnitConfig('email-queue')->getTableName(); - - // 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 ; - } - - $mailing_list_helper = $this->Application->recallObject('MailingListHelper'); - /* @var $mailing_list_helper MailingListHelper */ - - $mailing_list_helper->processQueue($messages); - } - - /** * Returns HTML of sent e-mail for iframe * * @param kEvent $event