• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/bitrix24disk/legacy/diskstorage.php
  • Класс: BitrixDiskBitrix24DiskLegacyDiskStorage
  • Вызов: DiskStorage::processWithLockedFile
private function processWithLockedFile(File $file, $fileArray, $fileId = null)
{
	$folderForSavedFiles = $this->storage->getFolderForSavedFiles();
	if(!$folderForSavedFiles)
	{
		$fileId && CFile::delete($fileId);
		$this->errorCollection[] = new Error("Could not " . __METHOD__, 686111);
		$this->errorCollection->add($this->storage->getErrors());

		return null;
	}

	if($fileId)
	{
		$forkedFile = $folderForSavedFiles->addFile(array(
			'NAME' => $file->getName(),
			'FILE_ID' => $fileId,
			'SIZE' => $fileArray['size'],
			'CREATED_BY' => $this->getUser()->getId(),
		), array(), true);
	}
	else
	{
		$forkedFile = $folderForSavedFiles->uploadFile($fileArray, array(
			'NAME' => $file->getName(),
			'CREATED_BY' => $this->getUser()->getId(),
		), array(), true);
	}

	if(!$forkedFile)
	{
		$fileId && CFile::delete($fileId);
		$this->errorCollection[] = new Error("Could not " . __METHOD__, 686112);
		$this->errorCollection->add($folderForSavedFiles->getErrors());

		return null;
	}

	return $forkedFile;
}