• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/bitrix24disk/legacy/diskstorage.php
  • Класс: BitrixDiskBitrix24DiskLegacyDiskStorage
  • Вызов: DiskStorage::lockFile
public function lockFile(array $file)
{
	if(!Configuration::isEnabledObjectLock())
	{
		$this->errorCollection[] = new Error(
			'Lock is disabled',
			181551
		);

		return false;
	}

	/** @var File $file */
	$file = File::loadById($file['extra']['id']);
	if(!$file)
	{
		$this->errorCollection->add(array(new Error("Could not " . __METHOD__ . " by id {$file['extra']['id']}", 181606)));
		return false;
	}

	if(!$file->canLock($this->storage->getSecurityContext($this->userId)))
	{
		throw new AccessDeniedException;
	}

	if(!$file->lock($this->getUser()->getId()))
	{
		$this->errorCollection[] = new Error(
			"Could not " . __METHOD__ . " by id {$file['extra']['id']}",
			181552
		);
		$this->errorCollection->add($file->getErrors());

		return false;
	}

	return true;
}