Index: branches/5.2.x/core/units/email_templates/email_template_eh.php =================================================================== diff -u -N -r16513 -r16598 --- branches/5.2.x/core/units/email_templates/email_template_eh.php (.../email_template_eh.php) (revision 16513) +++ branches/5.2.x/core/units/email_templates/email_template_eh.php (.../email_template_eh.php) (revision 16598) @@ -1,6 +1,6 @@ Array ('self' => 'edit'), 'OnSaveSelected' => Array ('self' => 'view'), - 'OnProcessEmailQueue' => Array ('self' => 'add|edit'), 'OnExportEmailTemplates' => Array ('self' => 'view'), 'OnSuggestAddressJSON' => Array ('self' => 'add|edit'), @@ -220,72 +219,6 @@ } /** - * Process emails from queue - * - * @param kEvent $event - * @todo Move to MailingList - */ - function OnProcessEmailQueue($event) - { - $deliver_count = $event->getEventParam('deliver_count'); - if ( $deliver_count === false ) { - $deliver_count = $this->Application->ConfigValue('MailingListSendPerStep'); - if ( $deliver_count === false ) { - $deliver_count = 10; // 10 emails per script run (if not specified directly) - } - } - - $processing_type = $this->Application->GetVar('type'); - if ( $processing_type = 'return_progress' ) { - $email_queue_progress = $this->Application->RecallVar('email_queue_progress'); - if ( $email_queue_progress === false ) { - $emails_sent = 0; - $sql = 'SELECT COUNT(*) - FROM ' . TABLE_PREFIX . 'EmailQueue - WHERE (SendRetries < 5) AND (LastSendRetry < ' . strtotime('-2 hours') . ')'; - $total_emails = $this->Conn->GetOne($sql); - $this->Application->StoreVar('email_queue_progress', $emails_sent . ':' . $total_emails); - } - else { - list ($emails_sent, $total_emails) = explode(':', $email_queue_progress); - } - } - - $sql = 'SELECT * - FROM ' . TABLE_PREFIX . 'EmailQueue - WHERE (SendRetries < 5) AND (LastSendRetry < ' . strtotime('-2 hours') . ') - LIMIT 0,' . $deliver_count; - $messages = $this->Conn->Query($sql); - - $message_count = count($messages); - if ( !$message_count ) { - // no messages left to send in queue - if ( $processing_type = 'return_progress' ) { - $this->Application->RemoveVar('email_queue_progress'); - $this->Application->Redirect($this->Application->GetVar('finish_template')); - } - return; - } - - /** @var MailingListHelper $mailing_list_helper */ - $mailing_list_helper = $this->Application->recallObject('MailingListHelper'); - - $mailing_list_helper->processQueue($messages); - - if ( $processing_type = 'return_progress' ) { - $emails_sent += $message_count; - if ( $emails_sent >= $total_emails ) { - $this->Application->RemoveVar('email_queue_progress'); - $this->Application->Redirect($this->Application->GetVar('finish_template')); - } - - $this->Application->StoreVar('email_queue_progress', $emails_sent . ':' . $total_emails); - $event->status = kEvent::erSTOP; - echo ($emails_sent / $total_emails) * 100; - } - } - - /** * Prefills module dropdown * * @param kEvent $event @@ -745,4 +678,4 @@ $this->clearSelectedIDs($event); } - } \ No newline at end of file + }