• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/cloudimport/importmanager.php
  • Класс: BitrixDiskDocumentCloudImportImportManager
  • Вызов: ImportManager::uploadVersion
public function uploadVersion(Entry $entry)
{
	if(!$entry->getTmpFile())
	{
		$this->errorCollection->addOne(new Error('Could not find cloud import', self::ERROR_COULD_NOT_FIND_CLOUD_IMPORT));
		return null;
	}

	if($entry->getContentSize() != $entry->getDownloadedContentSize())
	{
		$this->errorCollection->addOne(new Error('Content size != downloaded content size'));
		return null;
	}

	/** @var File $file */
	$file = $entry->getObject();
	if(!$file)
	{
		$this->errorCollection->addOne(new Error('Could not get file from cloud import record'));
		return null;
	}

	$tmpFile = $entry->getTmpFile();
	$fileArray = CFile::makeFileArray($tmpFile->getAbsolutePath());
	$version = $file->uploadVersion($fileArray, $this->documentHandler->getUserId());
	if(!$version)
	{
		$tmpFile->delete();
		$this->errorCollection->add($file->getErrors());
		return null;
	}
	$entry->linkVersion($version);

	return $version;
}