PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
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
← All changes | back/Classes/ScenarioQueueClass.php +42 -0 11.1.1 → 11.1.0 View file →
@@ -1,0 +1,42 @@
1 +<?php
2 +
3 +namespace AcyMailing\Classes;
4 +
5 +use AcyMailing\Core\AcymClass;
6 +
7 +class ScenarioQueueClass extends AcymClass
8 +{
9 + public function __construct()
10 + {
11 + parent::__construct();
12 +
13 + $this->table = 'scenario_queue';
14 + $this->pkey = 'id';
15 + }
16 +
17 + public function deleteByStepIds(array $stepIds): ?int
18 + {
19 + foreach ($stepIds as $key => $stepId) {
20 + $stepIds[$key] = acym_escapeDB($stepId);
21 + }
22 +
23 + return acym_query('DELETE FROM #__acym_'.acym_secureDBColumn($this->table).' WHERE `step_id` IN ('.implode(',', $stepIds).')');
24 + }
25 +
26 + public function getByProcessId(int $processId): ?object
27 + {
28 + $query = 'SELECT step.type, step.params, queue.execution_date FROM #__acym_scenario_queue AS `queue`
29 + JOIN #__acym_scenario_step AS `step` ON step.id = queue.step_id
30 + WHERE queue.scenario_process_id = '.$processId;
31 +
32 + $nextStep = acym_loadObject($query);
33 +
34 + if (empty($nextStep)) {
35 + return null;
36 + }
37 +
38 + $nextStep->params = json_decode($nextStep->params, true);
39 +
40 + return $nextStep;
41 + }
42 +}