diff --git a/mailpoet/lib/Automation/Engine/Control/StepHandler.php b/mailpoet/lib/Automation/Engine/Control/StepHandler.php index 868c8cd160..4d66de1ec3 100644 --- a/mailpoet/lib/Automation/Engine/Control/StepHandler.php +++ b/mailpoet/lib/Automation/Engine/Control/StepHandler.php @@ -120,7 +120,7 @@ class StepHandler { $stepType = $step->getType(); if (isset($this->stepRunners[$stepType])) { - $log = new WorkflowRunLog($workflowRun->getId(), $step->getId(), $args); + $log = new WorkflowRunLog($workflowRun->getId(), $step->getId()); try { $this->stepRunners[$stepType]->run($step, $workflow, $workflowRun); $log->markCompletedSuccessfully(); diff --git a/mailpoet/lib/Automation/Engine/Data/WorkflowRunLog.php b/mailpoet/lib/Automation/Engine/Data/WorkflowRunLog.php index dfb3a6c4cb..cceb3b7afe 100644 --- a/mailpoet/lib/Automation/Engine/Data/WorkflowRunLog.php +++ b/mailpoet/lib/Automation/Engine/Data/WorkflowRunLog.php @@ -39,18 +39,13 @@ class WorkflowRunLog { /** @var string */ private $stepId; - /** @var array */ - private $args; - public function __construct( int $workflowRunId, string $stepId, - array $args, int $id = null ) { $this->workflowRunId = $workflowRunId; $this->stepId = $stepId; - $this->args = $args; $this->status = self::STATUS_RUNNING; if ($id) { @@ -79,10 +74,6 @@ class WorkflowRunLog { return $this->status; } - public function getArgs(): array { - return $this->args; - } - public function getError(): array { return $this->error; } @@ -126,7 +117,6 @@ class WorkflowRunLog { 'status' => $this->status, 'started_at' => $this->startedAt->format(DateTimeImmutable::W3C), 'completed_at' => $this->completedAt ? $this->completedAt->format(DateTimeImmutable::W3C) : null, - 'args' => Json::encode($this->args), 'error' => Json::encode($this->error), 'data' => Json::encode($this->data), ]; @@ -154,12 +144,11 @@ class WorkflowRunLog { } public static function fromArray(array $data): self { - $workflowRunLog = new WorkflowRunLog((int)$data['workflow_run_id'], $data['step_id'], []); + $workflowRunLog = new WorkflowRunLog((int)$data['workflow_run_id'], $data['step_id']); $workflowRunLog->id = (int)$data['id']; $workflowRunLog->status = $data['status']; $workflowRunLog->error = Json::decode($data['error']); $workflowRunLog->data = Json::decode($data['data']); - $workflowRunLog->args = Json::decode($data['args']); $workflowRunLog->startedAt = new DateTimeImmutable($data['started_at']); if ($data['completed_at']) { diff --git a/mailpoet/lib/Automation/Engine/Migrations/Migrator.php b/mailpoet/lib/Automation/Engine/Migrations/Migrator.php index ce6283b52f..f1b78bb791 100644 --- a/mailpoet/lib/Automation/Engine/Migrations/Migrator.php +++ b/mailpoet/lib/Automation/Engine/Migrations/Migrator.php @@ -70,7 +70,6 @@ class Migrator { status varchar(255) NOT NULL, started_at timestamp NOT NULL, completed_at timestamp NULL DEFAULT NULL, - args longtext, error longtext, data longtext, PRIMARY KEY (id), diff --git a/mailpoet/tests/integration/Automation/Engine/Data/WorkflowRunLogTest.php b/mailpoet/tests/integration/Automation/Engine/Data/WorkflowRunLogTest.php index 5f80b7d9ee..050c1abfc5 100644 --- a/mailpoet/tests/integration/Automation/Engine/Data/WorkflowRunLogTest.php +++ b/mailpoet/tests/integration/Automation/Engine/Data/WorkflowRunLogTest.php @@ -50,7 +50,7 @@ class WorkflowRunLogTest extends \MailPoetTest { } public function testItAllowsSettingData(): void { - $log = new WorkflowRunLog(1, 'step-id', []); + $log = new WorkflowRunLog(1, 'step-id'); $this->assertSame([], $log->getData()); $log->setData('key', 'value'); $data = $log->getData(); @@ -59,7 +59,7 @@ class WorkflowRunLogTest extends \MailPoetTest { } public function testItDoesNotAllowSettingDataThatCannotBeSaved(): void { - $log = new WorkflowRunLog(1, 'step-id', []); + $log = new WorkflowRunLog(1, 'step-id'); $badData = [ function() { echo 'closures cannot be serialized'; } ]; @@ -157,12 +157,6 @@ class WorkflowRunLogTest extends \MailPoetTest { expect(count($error['trace']))->greaterThan(0); } - public function testItLogsStepArgs(): void { - $log = $this->getLogsForAction()[0]; - expect($log->getArgs())->count(2); - expect(array_keys($log->getArgs()))->equals(['workflow_run_id', 'step_id']); - } - public function _after() { global $wpdb; $sql = 'truncate ' . $wpdb->prefix . 'mailpoet_workflow_run_logs'; diff --git a/mailpoet/tests/integration/Automation/Engine/Storage/WorkflowRunLogStorageTest.php b/mailpoet/tests/integration/Automation/Engine/Storage/WorkflowRunLogStorageTest.php index 1c043f25ac..8b57538282 100644 --- a/mailpoet/tests/integration/Automation/Engine/Storage/WorkflowRunLogStorageTest.php +++ b/mailpoet/tests/integration/Automation/Engine/Storage/WorkflowRunLogStorageTest.php @@ -15,7 +15,7 @@ class WorkflowRunLogStorageTest extends \MailPoetTest { } public function testItSavesAndRetrievesAsExpected() { - $log = new WorkflowRunLog(1, 'step-id', []); + $log = new WorkflowRunLog(1, 'step-id'); $log->setData('key', 'value'); $log->setData('key2', ['arrayData']); $preSave = $log->toArray(); @@ -26,7 +26,7 @@ class WorkflowRunLogStorageTest extends \MailPoetTest { } public function testItCanStoreAnError() { - $log = new WorkflowRunLog(1, 'step-id', []); + $log = new WorkflowRunLog(1, 'step-id'); $log->setError(new \Exception('test')); $id = $this->storage->createWorkflowRunLog($log); $log = $this->storage->getWorkflowRunLog($id);