mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
type fixes
This commit is contained in:
@@ -48,10 +48,19 @@ use Espo\Entities\{
|
||||
*/
|
||||
class Manager
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $cacheKey = 'webhooks';
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $skipAttributeList = ['isFollowed', 'modifiedAt', 'modifiedBy'];
|
||||
|
||||
/**
|
||||
* @var ?array<string,bool>
|
||||
*/
|
||||
private $data = null;
|
||||
|
||||
private $config;
|
||||
@@ -102,6 +111,9 @@ class Manager
|
||||
$this->dataCache->store($this->cacheKey, $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string,bool>
|
||||
*/
|
||||
private function buildData(): array
|
||||
{
|
||||
$data = [];
|
||||
|
||||
@@ -248,6 +248,9 @@ class Queue
|
||||
$this->send($webhook, $dataList, $actualItemList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $forbiddenAttributeList
|
||||
*/
|
||||
private function prepareItemData(WebhookQueueItem $item, ?User $user, array $forbiddenAttributeList): ?stdClass
|
||||
{
|
||||
$targetType = $item->get('targetType');
|
||||
@@ -285,6 +288,10 @@ class Queue
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed[] $dataList
|
||||
* @param WebhookQueueItem[] $itemList
|
||||
*/
|
||||
private function send(Webhook $webhook, array $dataList, array $itemList): void
|
||||
{
|
||||
try {
|
||||
@@ -324,6 +331,9 @@ class Queue
|
||||
$this->log->debug("Webhook Queue: Webhook '" . $webhook->getId() . "' sent, response code: {$code}.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebhookQueueItem[] $itemList
|
||||
*/
|
||||
protected function failQueueItemList(array $itemList, bool $force = false): void
|
||||
{
|
||||
foreach ($itemList as $item) {
|
||||
@@ -331,6 +341,9 @@ class Queue
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebhookQueueItem[] $itemList
|
||||
*/
|
||||
protected function succeedQueueItemList(array $itemList): void
|
||||
{
|
||||
foreach ($itemList as $item) {
|
||||
|
||||
@@ -44,13 +44,16 @@ class Sender
|
||||
|
||||
private const TIMEOUT = 10;
|
||||
|
||||
private $config;
|
||||
private Config $config;
|
||||
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int,mixed> $dataList
|
||||
*/
|
||||
public function send(Webhook $webhook, array $dataList): int
|
||||
{
|
||||
$payload = json_encode($dataList);
|
||||
|
||||
Reference in New Issue
Block a user