Don't escape table names when not needed
[MAILPOET-4778]
This commit is contained in:
@ -19,6 +19,9 @@ class WorkflowStorage {
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
private $triggersTable;
|
private $triggersTable;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $runsTable;
|
||||||
|
|
||||||
/** @var wpdb */
|
/** @var wpdb */
|
||||||
private $wpdb;
|
private $wpdb;
|
||||||
|
|
||||||
@ -27,6 +30,7 @@ class WorkflowStorage {
|
|||||||
$this->workflowsTable = $wpdb->prefix . 'mailpoet_workflows';
|
$this->workflowsTable = $wpdb->prefix . 'mailpoet_workflows';
|
||||||
$this->versionsTable = $wpdb->prefix . 'mailpoet_workflow_versions';
|
$this->versionsTable = $wpdb->prefix . 'mailpoet_workflow_versions';
|
||||||
$this->triggersTable = $wpdb->prefix . 'mailpoet_workflow_triggers';
|
$this->triggersTable = $wpdb->prefix . 'mailpoet_workflow_triggers';
|
||||||
|
$this->runsTable = $wpdb->prefix . 'mailpoet_workflow_runs';
|
||||||
$this->wpdb = $wpdb;
|
$this->wpdb = $wpdb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,9 +156,7 @@ class WorkflowStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function deleteWorkflow(Workflow $workflow): void {
|
public function deleteWorkflow(Workflow $workflow): void {
|
||||||
$workflowsTable = esc_sql($this->workflowsTable);
|
$workflowRunsTable = esc_sql($this->runsTable);
|
||||||
$versionsTable = esc_sql($this->versionsTable);
|
|
||||||
$workflowRunsTable = esc_sql($this->wpdb->prefix . 'mailpoet_workflow_runs');
|
|
||||||
$workflowRunLogsTable = esc_sql($this->wpdb->prefix . 'mailpoet_workflow_run_logs');
|
$workflowRunLogsTable = esc_sql($this->wpdb->prefix . 'mailpoet_workflow_run_logs');
|
||||||
$workflowId = $workflow->getId();
|
$workflowId = $workflow->getId();
|
||||||
$runLogsQuery = (string)$this->wpdb->prepare(
|
$runLogsQuery = (string)$this->wpdb->prepare(
|
||||||
@ -173,12 +175,12 @@ class WorkflowStorage {
|
|||||||
throw Exceptions::databaseError($this->wpdb->last_error);
|
throw Exceptions::databaseError($this->wpdb->last_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$runsDeleted = $this->wpdb->delete($this->wpdb->prefix . 'mailpoet_workflow_runs', ['workflow_id' => $workflowId]);
|
$runsDeleted = $this->wpdb->delete($this->runsTable, ['workflow_id' => $workflowId]);
|
||||||
if ($runsDeleted === false) {
|
if ($runsDeleted === false) {
|
||||||
throw Exceptions::databaseError($this->wpdb->last_error);
|
throw Exceptions::databaseError($this->wpdb->last_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$versionsDeleted = $this->wpdb->delete($versionsTable, ['workflow_id' => $workflowId]);
|
$versionsDeleted = $this->wpdb->delete($this->versionsTable, ['workflow_id' => $workflowId]);
|
||||||
if ($versionsDeleted === false) {
|
if ($versionsDeleted === false) {
|
||||||
throw Exceptions::databaseError($this->wpdb->last_error);
|
throw Exceptions::databaseError($this->wpdb->last_error);
|
||||||
}
|
}
|
||||||
@ -188,7 +190,7 @@ class WorkflowStorage {
|
|||||||
throw Exceptions::databaseError($this->wpdb->last_error);
|
throw Exceptions::databaseError($this->wpdb->last_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$workflowDeleted = $this->wpdb->delete($workflowsTable, ['id' => $workflowId]);
|
$workflowDeleted = $this->wpdb->delete($this->workflowsTable, ['id' => $workflowId]);
|
||||||
if ($workflowDeleted === false) {
|
if ($workflowDeleted === false) {
|
||||||
throw Exceptions::databaseError($this->wpdb->last_error);
|
throw Exceptions::databaseError($this->wpdb->last_error);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user