changes for filter and print

This commit is contained in:
2024-09-29 16:59:27 +05:45
parent 497f567cba
commit 684e01bf48
1335 changed files with 38709 additions and 74987 deletions

View File

@ -1,5 +1,13 @@
# Changelog
## 7.2.4
* [Fixed] Timeout option is propagated to guzzle client
## 7.2.3
* [Fixed] Include socket_id in batch trigger if included.
## 7.2.2
* [FIXED] composer.phar file removed from package

View File

@ -19,7 +19,7 @@ class Pusher implements LoggerAwareInterface, PusherInterface
/**
* @var string Version
*/
public static $VERSION = '7.2.2';
public static $VERSION = '7.2.4';
/**
* @var null|PusherCrypto
@ -64,12 +64,6 @@ class Pusher implements LoggerAwareInterface, PusherInterface
{
$this->check_compatibility();
if (!is_null($client)) {
$this->client = $client;
} else {
$this->client = new \GuzzleHttp\Client();
}
$useTLS = true;
if (isset($options['useTLS'])) {
$useTLS = $options['useTLS'] === true;
@ -119,6 +113,13 @@ class Pusher implements LoggerAwareInterface, PusherInterface
);
$this->crypto = new PusherCrypto($parsedKey);
}
if (!is_null($client)) {
$this->client = $client;
} else {
$this->client = new \GuzzleHttp\Client(['timeout' => $this->settings['timeout'],]);
}
}
/**
@ -475,8 +476,8 @@ class Pusher implements LoggerAwareInterface, PusherInterface
*/
public function sendToUser(string $user_id, string $event, $data, bool $already_encoded = false): object
{
$this->validate_user_id($user_id);
return $this->trigger(["#server-to-user-$user_id"], $event, $data, [], $already_encoded);
$this->validate_user_id($user_id);
return $this->trigger(["#server-to-user-$user_id"], $event, $data, [], $already_encoded);
}
/**
@ -492,8 +493,8 @@ class Pusher implements LoggerAwareInterface, PusherInterface
*/
public function sendToUserAsync(string $user_id, string $event, $data, bool $already_encoded = false): PromiseInterface
{
$this->validate_user_id($user_id);
return $this->triggerAsync(["#server-to-user-$user_id"], $event, $data, [], $already_encoded);
$this->validate_user_id($user_id);
return $this->triggerAsync(["#server-to-user-$user_id"], $event, $data, [], $already_encoded);
}
@ -724,7 +725,8 @@ class Pusher implements LoggerAwareInterface, PusherInterface
'query' => $signature,
'http_errors' => false,
'headers' => $headers,
'base_uri' => $this->channels_url_prefix()
'base_uri' => $this->channels_url_prefix(),
'timeout' => $this->settings['timeout']
]);
$status = $response->getStatusCode();
@ -776,7 +778,8 @@ class Pusher implements LoggerAwareInterface, PusherInterface
'body' => $body,
'http_errors' => false,
'headers' => $headers,
'base_uri' => $this->channels_url_prefix()
'base_uri' => $this->channels_url_prefix(),
'timeout' => $this->settings['timeout']
]);
} catch (ConnectException $e) {
throw new ApiErrorException($e->getMessage());
@ -826,7 +829,8 @@ class Pusher implements LoggerAwareInterface, PusherInterface
'body' => $body,
'http_errors' => false,
'headers' => $headers,
'base_uri' => $this->channels_url_prefix()
'base_uri' => $this->channels_url_prefix(),
'timeout' => $this->settings['timeout'],
])->then(function ($response) {
$status = $response->getStatusCode();
@ -914,7 +918,7 @@ class Pusher implements LoggerAwareInterface, PusherInterface
return $response;
}
/**
/**
* Convenience function for presence channel authorization.
*
* Equivalent to authorizeChannel($channel, $socket_id, json_encode(['user_id' => $user_id, 'user_info' => $user_info], JSON_THROW_ON_ERROR))
@ -1061,7 +1065,7 @@ class Pusher implements LoggerAwareInterface, PusherInterface
*/
private function make_event(array $channels, string $event, $data, array $params = [], ?string $info = null, bool $already_encoded = false): array
{
$has_encrypted_channel = false;
$has_encrypted_channel = false;
foreach ($channels as $chan) {
if (PusherCrypto::is_encrypted_channel($chan)) {
$has_encrypted_channel = true;
@ -1102,12 +1106,12 @@ class Pusher implements LoggerAwareInterface, PusherInterface
$post_params['data'] = $data_encoded;
$channel_values = array_values($channels);
if (count($channel_values) == 1) {
$post_params['channel'] = $channel_values[0];
$post_params['channel'] = $channel_values[0];
} else {
$post_params['channels'] = $channel_values;
$post_params['channels'] = $channel_values;
}
if (!is_null($info)) {
$post_params['info'] = $info;
$post_params['info'] = $info;
}
return array_merge($post_params, $params);
@ -1166,9 +1170,10 @@ class Pusher implements LoggerAwareInterface, PusherInterface
$this->validate_channel($event['channel']);
if (isset($event['socket_id'])) {
$this->validate_socket_id($event['socket_id']);
$batch[$key] = $this->make_event([$event['channel']], $event['name'], $event['data'], ['socket_id' => $event['socket_id']], $event['info'] ?? null, $already_encoded);
} else {
$batch[$key] = $this->make_event([$event['channel']], $event['name'], $event['data'], [], $event['info'] ?? null, $already_encoded);
}
$batch[$key] = $this->make_event([$event['channel']], $event['name'], $event['data'], [], $event['info'] ?? null, $already_encoded);
}
try {