• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/filelink.php
  • Класс: BitrixDiskFileLink
  • Вызов: FileLink::add
static function add(array $data, ErrorCollection $errorCollection)
{
	$result = FileTable::add($data);
	if (!$result->isSuccess())
	{
		$errorCollection->addFromResult($result);
		return null;
	}

	$file = static::buildFromResult($result);
	if($file && $file->getCreatedBy() && !$file->isDeleted())
	{
		$driver = Driver::getInstance();

		$driver->sendChangeStatusToSubscribers($file, 'quick');
		$storage = $file->getStorage();
		if ($storage->isUseInternalRights())
		{
			$userId = $file->getCreatedBy();
			if ($storage->getProxyType() instanceof ProxyTypeUser)
			{
				$userId = $storage->getEntityId();
			}

			$driver->getRecentlyUsedManager()->push(
				$userId,
				$file
			);
		}
	}

	if($file)
	{
		$event = new Event(Driver::INTERNAL_MODULE_ID, "onAfterAddFileLink", array($file));
		$event->send();
	}

	return $file;
}