• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/documentcontroller.php
  • Класс: BitrixDiskDocumentDocumentController
  • Вызов: DocumentController::processWithLockedFile
private function processWithLockedFile($fileId, $fileArray)
{
	$userStorage = Driver::getInstance()->getStorageByUserId($this->getUser()->getId());
	$folderForSavedFiles = $userStorage->getFolderForSavedFiles();
	if(!$folderForSavedFiles)
	{
		CFile::delete($fileId);
		$this->errorCollection[] = new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_SAVE_FILE'), self::ERROR_COULD_NOT_SAVE_FILE);
		$this->errorCollection->add($userStorage->getErrors());

		$this->sendJsonErrorResponse();
	}

	$forkedFile = $folderForSavedFiles->addFile(array(
		'NAME' => $this->file->getName(),
		'FILE_ID' => $fileId,
		'SIZE' => $fileArray['size'],
		'CREATED_BY' => $this->getUser()->getId(),
	), array(), true);
	if(!$forkedFile)
	{
		CFile::delete($fileId);
		$this->errorCollection[] = new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_SAVE_FILE'), self::ERROR_COULD_NOT_SAVE_FILE);
		$this->errorCollection->add($folderForSavedFiles->getErrors());

		$this->sendJsonErrorResponse();
	}

	$this->sendJsonSuccessResponse(array(
		'originalIsLocked' => true,
		'forkedObject' => array(
			'id' => $forkedFile->getId(),
			'name' => $forkedFile->getName(),
		)
	));
}