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/im/lib/update/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/im/lib/update/removehumantype.php
<?php

namespace Bitrix\Im\Update;

use Bitrix\Im\Model\BotTable;
use Bitrix\Im\V2\Entity\User\Data\BotData;
use Bitrix\Main\Config\Option;
use Bitrix\Main\Loader;
use Bitrix\Main\Update\Stepper;

class RemoveHumanType extends Stepper
{
	public const OPTION_NAME = 'remove_human_type_stepper_params';
	private const MODULE_ID = 'im';

	private int $queryCount = 50;

	function execute(array &$result)
	{
		if (!Loader::includeModule(self::MODULE_ID))
		{
			return false;
		}

		$params = Option::get(self::MODULE_ID, self::OPTION_NAME, "");
		$params = ($params !== "" ? @unserialize($params, ['allowed_classes' => false]) : []);
		$params = (is_array($params) ? $params : []);

		if (empty($params))
		{
			$lastId = 0;
		}

		$lastId = $lastId ?? $params['lastId'];

		$query = BotTable::query()
			->setSelect(['BOT_ID', 'TYPE'])
			->setLimit($this->queryCount)
			->setOrder('BOT_ID', 'ASC')
			->where('BOT_ID' ,'>', $lastId)
			->exec()
		;

		$found = false;
		$botIds = [];
		while ($row = $query->fetch())
		{
			$lastId = (int)$row['BOT_ID'];
			$params['lastId'] = $lastId;

			if ($row['TYPE'] === 'H')
			{
				$botIds[] = $lastId;
			}

			$found = true;
		}

		if (!empty($botIds))
		{
			BotTable::updateByFilter(
				[
					'=BOT_ID' => $botIds,
					'=TYPE' => 'H',
				],
				['TYPE' => 'B']
			);
		}

		foreach ($botIds as $botId)
		{
			BotData::cleanCache($botId);
		}

		if ($found)
		{
			Option::set(self::MODULE_ID, self::OPTION_NAME, serialize($params));

			return true;
		}

		Option::delete(self::MODULE_ID, ["name" => self::OPTION_NAME]);

		\Bitrix\Im\Bot::clearCache();

		return false;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit