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/ui/lib/FileUploader/ |
Upload File : |
<?php namespace Bitrix\UI\FileUploader; use Bitrix\Main\Type\DateTime; class TempFileAgent { const AGENT_MAX_INTERVAL = 1800; const AGENT_MIN_INTERVAL = 360; public static function clearOldRecords(): string { $expired = new DateTime(); $expired->add('-1 days'); $limit = 20; $tempFiles = TempFileTable::getList([ 'filter' => ['<CREATED_AT' => $expired->toString()], 'limit' => $limit, 'order' => ['CREATED_AT' => 'ASC'] ])->fetchCollection(); foreach ($tempFiles as $tempFile) { $tempFile->delete(); } $agentName = '\\' . __METHOD__ . '();'; $agents = \CAgent::getList(['ID' => 'DESC'], [ 'MODULE_ID' => 'ui', 'NAME' => $agentName, ]); if ($agent = $agents->fetch()) { $interval = $tempFiles->count() < $limit ? static::AGENT_MAX_INTERVAL : static::AGENT_MIN_INTERVAL; if ((int)$agent['AGENT_INTERVAL'] !== $interval) { \CAgent::update($agent['ID'], ['AGENT_INTERVAL' => $interval]); } } return $agentName; } }