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/rest/lib/marketplace/ |
Upload File : |
<?php namespace Bitrix\Rest\Marketplace; use Bitrix\Main\Data\Cache; use Bitrix\Main\DB\Exception; use Bitrix\Main\SystemException; use Bitrix\Rest\Internals\FreeAppTable; /** * Class Immune * @package Bitrix\Rest\Marketplace */ class Immune { private const CACHE_TTL_TIMEOUT = 86400; private const CACHE_DIR = '/rest/'; private static $immuneAppList; /** * @return array */ public static function getList(): array { if (!is_array(static::$immuneAppList)) { static::$immuneAppList = []; $cache = Cache::createInstance(); if ($cache->initCache(static::CACHE_TTL_TIMEOUT, 'immuneAppList', static::CACHE_DIR)) { $result = $cache->getVars(); static::$immuneAppList = is_array($result) ? $result : []; } elseif ($cache->startDataCache()) { try { $appList = FreeAppTable::query() ->setSelect(['APP_CODE']) ->fetchAll(); static::$immuneAppList = $appList; } catch (\Exception $exception) { static::$immuneAppList = []; } $cache->endDataCache(is_array(static::$immuneAppList) ? static::$immuneAppList : []); } static::$immuneAppList = array_map(fn($app) => $app['APP_CODE'], static::$immuneAppList); } return static::$immuneAppList; } private static function getExternal(): array { $immuneAppList = Client::getImmuneApp(); FreeAppTable::updateFreeAppTable($immuneAppList); $cache = Cache::createInstance(); $cache->clean('immuneAppList', static::CACHE_DIR); return $immuneAppList; } /** * Agent load external app list * @return string */ public static function load() : string { static::getExternal(); return '\Bitrix\Rest\Marketplace\Immune::load();'; } }