= esc_sql($this->subjectTable); $sql = "SELECT count(DISTINCT runs.id) as count from $table as runs JOIN $subjectTable as subjects on runs.id = subjects.automation_run_id WHERE runs.automation_id = %d AND subjects.hash = %s"; $result = $this->wpdb->get_col( (string)$this->wpdb->prepare($sql, $automation->getId(), $subject->getHash()) ); return $result ? (int)current($result) : 0; } public function getCountForAutomation(Automation $automation, string ...$status): int { if (!count($status)) { return 0; } $table = esc_sql($this->table); $statusSql = (string)$this->wpdb->prepare(implode(',', array_fill(0, count($status), '%s')), ...$status); $query = (string)$this->wpdb->prepare(" SELECT COUNT(id) as count FROM $table WHERE automation_id = %d AND status IN ($statusSql) ", $automation->getId()); $result = $this->wpdb->get_col($query); return $result ? (int)current($result) : 0; } public function updateStatus(int $id, string $status): void { $table = esc_sql($this->table); $query = (string)$this->wpdb->prepare(" UPDATE $table SET status = %s, updated_at = current_timestamp() WHERE id = %d ", $status, $id); $result = $this->wpdb->query($query); if ($result === false) { throw Exceptions::databaseError($this->wpdb->last_error); } } public function updateNextStep(int $id, ?string $nextStepId): void { $table = esc_sql($this->table); $query = (string)$this->wpdb->prepare(" UPDATE $table SET next_step_id = %s, updated_at = current_timestamp() WHERE id = %d ", $nextStepId, $id); $result = $this->wpdb->query($query); if ($result === false) { throw Exceptions::databaseError($this->wpdb->last_error); } } public function getAutomationStepStatisticForTimeFrame(int $automationId, string $status, \DateTimeImmutable $after, \DateTimeImmutable $before, int $versionId = null): array { $table = esc_sql($this->table); $where = "automation_id = %d AND `status` = %s AND created_at BETWEEN %s AND %s"; if ($versionId) { $where .= " AND version_id = %d"; } $sql = " SELECT COUNT(id) AS `count`, next_step_id FROM $table as log WHERE $where GROUP BY next_step_id "; $sql = $versionId ? $this->wpdb->prepare($sql, $automationId, $status, $after->format('Y-m-d H:i:s'), $before->format('Y-m-d H:i:s'), $versionId) : $this->wpdb->prepare($sql, $automationId, $status, $after->format('Y-m-d H:i:s'), $before->format('Y-m-d H:i:s')); $sql = is_string($sql) ? $sql : ''; $result = $this->wpdb->get_results($sql, ARRAY_A); return is_array($result) ? $result : []; } public function truncate(): void { $table = esc_sql($this->table); $this->wpdb->query("TRUNCATE $table"); $table = esc_sql($this->subjectTable); $this->wpdb->query("TRUNCATE $table"); } }
Fatal error: Uncaught Error: Class "MailPoet\Automation\Engine\Storage\AutomationRunStorage" not found in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php:1405 Stack trace: #0 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(1519): MailPoetGenerated\FreeCachedContainer->getStepHandlerService() #1 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2276): MailPoetGenerated\FreeCachedContainer->getEngineService() #2 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(122): MailPoetGenerated\FreeCachedContainer->getInitializerService() #3 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(110): MailPoetVendor\Symfony\Component\DependencyInjection\Container->make('MailPoet\\Config...', 1) #4 /htdocs/wp-content/plugins/mailpoet/lib/DI/ContainerWrapper.php(39): MailPoetVendor\Symfony\Component\DependencyInjection\Container->get('MailPoet\\Config...') #5 /htdocs/wp-content/plugins/mailpoet/mailpoet_initializer.php(89): MailPoet\DI\ContainerWrapper->get('MailPoet\\Config...') #6 /htdocs/wp-content/plugins/mailpoet/mailpoet.php(206): require_once('/htdocs/wp-cont...') #7 /htdocs/wp-settings.php(462): include_once('/htdocs/wp-cont...') #8 /htdocs/wp-config.php(96): require_once('/htdocs/wp-sett...') #9 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #10 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #11 /htdocs/index.php(17): require('/htdocs/wp-blog...') #12 {main} thrown in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php on line 1405