/** * Complete bulk mail processing * * @access private * @return void */ private function _mailSendComplete() { $pergo = intval($this->request['pergo']); $id = intval($this->request['id']); if (!$id) { $this->registry->output->global_message = $this->lang->words['b_norecord']; $this->_mailStart(); return; } //----------------------------------------- // Get it from the db //----------------------------------------- $mail = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_id=' . $id)); if (!$mail['mail_subject'] and !$mail['mail_content']) { $this->registry->output->global_message = $this->lang->words['b_nosend']; $this->_mailStart(); return; } //----------------------------------------- // Update mail //----------------------------------------- if (!$pergo or $pergo > 1000) { $pergo = 50; } $this->DB->update('bulk_mail', array('mail_active' => 1, 'mail_pergo' => $pergo, 'mail_sentto' => 0, 'mail_start' => time()), 'mail_id=' . $id); $this->DB->update('bulk_mail', array('mail_active' => 0), 'mail_id <> ' . $id); //----------------------------------------- // Wake up task manager //----------------------------------------- require_once IPS_ROOT_PATH . 'sources/classes/class_taskmanager.php'; $task = new class_taskmanager($this->registry); $this->DB->update('task_manager', array('task_enabled' => 1), "task_key='bulkmail'"); $this_task = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'task_manager', 'where' => "task_key='bulkmail'")); $newdate = $task->generateNextRun($this_task); $this->DB->update('task_manager', array('task_next_run' => $newdate), "task_id=" . $this_task['task_id']); $task->saveNextRunStamp(); //----------------------------------------- // Sit back and watch the show //----------------------------------------- $this->registry->output->global_message = $this->lang->words['b_initiated']; $this->_mailStart(); }