• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/volume/cleaner.php
  • Класс: BitrixDiskVolumeCleaner
  • Вызов: Cleaner::runProcess
static function runProcess(): string
{
	$timer = new VolumeTimer();

	if (!self::isCronRun() && defined('START_EXEC_TIME') && START_EXEC_TIME > 0)
	{
		$timer
			->setTimeLimit(VolumeTimer::MAX_EXECUTION_TIME)
			->startTimer(START_EXEC_TIME);
	}
	else
	{
		$timer
			->setTimeLimit(VolumeTimer::MAX_EXECUTION_TIME * 20)
			->startTimer();
	}

	$workerResult = VolumeTable::getList([
		'select' => ['ID', 'OWNER_ID'],
		'filter' => [
			'=AGENT_LOCK' => [
				VolumeTask::TASK_STATUS_WAIT,
				VolumeTask::TASK_STATUS_RUNNING,
			],
		],
		'limit' => 100
	]);
	if ($workerResult->getSelectedRowsCount() > 0)
	{
		while ($taskRow = $workerResult->fetch())
		{
			$filterId = (int)$taskRow['ID'];

			$cleaner = new static();
			$cleaner->setTimer($timer);

			if ($cleaner->loadTask($filterId))
			{
				$cleaner->runTask();
			}

			if ($timer->hasTimeLimitReached())
			{
				break;
			}
		}

		// count statistic for progress bar
		self::countWorker();
	}
	else
	{
		return '';
	}

	return static::agentName();
}