PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.11.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.11.1
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Controllers / QueueController.php

QueueController.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.11.1, at back/Controllers/QueueController.php

74 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Controllers;
4
5 use AcyMailing\Classes\QueueClass;
6 use AcyMailing\Helpers\QueueHelper;
7 use AcyMailing\Core\AcymController;
8 use AcyMailing\Controllers\Queue\Campaigns;
9 use AcyMailing\Controllers\Queue\Scheduled;
10 use AcyMailing\Controllers\Queue\Detailed;
11
12 class QueueController extends AcymController
13 {
14 use Campaigns;
15 use Scheduled;
16 use Detailed;
17
18 public function __construct()
19 {
20 parent::__construct();
21
22 $this->breadcrumb[acym_translation('ACYM_QUEUE')] = acym_completeLink('queue');
23 $this->setDefaultTask('campaigns');
24 }
25
26 public function scheduleReady(): void
27 {
28 $queueClass = new QueueClass();
29 $queueClass->scheduleReady();
30 }
31
32 public function continuesend(): void
33 {
34 if ($this->config->get('queue_type') == 'onlyauto') {
35 acym_setNoTemplate();
36 acym_display(acym_translation('ACYM_ONLYAUTOPROCESS'), 'warning');
37
38 exit;
39 }
40
41 $newCronTime = time() + 120;
42 if ($this->config->get('cron_next') < $newCronTime) {
43 $this->config->saveConfig(['cron_next' => $newCronTime]);
44 }
45
46 $mailid = acym_getCID('id');
47
48 $totalSend = acym_getVar('int', 'totalsend', 0);
49 if (empty($totalSend)) {
50 $query = 'SELECT COUNT(queue.user_id) FROM #__acym_queue AS queue LEFT JOIN #__acym_campaign AS campaign ON queue.mail_id = campaign.mail_id WHERE (campaign.id IS NULL OR campaign.active = 1) AND queue.sending_date < '.acym_escapeDB(
51 acym_date('now', 'Y-m-d H:i:s', false)
52 );
53 if (!empty($mailid)) {
54 $query .= ' AND queue.mail_id = '.intval($mailid);
55 }
56 $totalSend = acym_loadResult($query);
57 }
58
59 $alreadySent = acym_getVar('int', 'alreadysent', 0);
60
61 $queueHelper = new QueueHelper();
62 $queueHelper->id = $mailid;
63 $queueHelper->report = true;
64 $queueHelper->total = (int)$totalSend;
65 $queueHelper->start = $alreadySent;
66 $queueHelper->pause = (int)$this->config->get('queue_pause', 0);
67 $queueHelper->fromManual = true;
68 $queueHelper->process();
69
70 acym_setNoTemplate();
71 exit;
72 }
73 }
74