Prevent Worker from running when 3rd parties are disabled

[MAILPOET-5826]
This commit is contained in:
David Remer
2024-01-12 09:47:45 +02:00
committed by Veljko V
parent 7defccd834
commit 836a23c1be

View File

@@ -24,9 +24,16 @@ class Beamer extends SimpleWorker {
}
public function processTaskStrategy(ScheduledTaskEntity $task, $timer) {
if (!$this->isBeamerEnabled()) {
return false;
}
return $this->setLastAnnouncementDate();
}
private function isBeamerEnabled(): bool {
return $this->settings->get('3rd_party_libs.enabled') === '1';
}
public function setLastAnnouncementDate() {
$response = $this->wp->wpRemoteGet(self::API_URL . '/posts?published=true&maxResults=1', [
'headers' => [