Base::lock

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Base
  4. lock
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/ui/webpack/base.php
  • Класс: Bitrix\Crm\UI\Webpack\Base
  • Вызов: Base::lock
private function lock(): bool
{
	$ttl = 30;
	$now = time();
	$name = $this->getLockFilename();
	if (!$name)
	{
		return true;
	}

	$file = new Main\IO\File($name);
	if ($file->isExists())
	{
		$ts = (int)$file->getContents();
		if ($ts > ($now - $ttl))
		{
			return false;
		}
	}

	$file->putContents((string)$now);
	return true;
}

Добавить комментарий