• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/virtualfilesystem.php
  • Класс: CAllDavVirtualFileSystem
  • Вызов: CAllDavVirtualFileSystem::Lock
static function Lock($path, $token, &$timeout, $owner, $scope, $type)
{
	if (!$path)
	{
		return false;
	}

	unset(self::$lockCache[$path]);

	if ($timeout < 1000000)				// < 1000000 is a relative timestamp, so we add the current time
	{
		$timeout += time();
	}

	if (($lock = self::CheckLock($path)) && ($lock['LOCK_SCOPE'] === 'exclusive' || $scope === 'exclusive'))
	{
		return false;
	}

	try
	{
		self::Add(array(
			"ID" => $token,
			"PATH" => $path,
			"EXPIRES" => $timeout,
			"LOCK_OWNER" => $owner,
			"LOCK_TYPE" => $type,
			"LOCK_SCOPE" => $scope,
		));

		return true;
	}
	catch (Exception $e)
	{
	}

	return false;
}