• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/downloadcontroller.php
  • Класс: BitrixDiskDownloadController
  • Вызов: DownloadController::onWorkWithOneFile
private function onWorkWithOneFile()
{
	if(!$this->checkRequiredGetParams(array('fileId')))
	{
		return new EventResult(EventResult::ERROR);
	}

	$this->fileId = (int)$this->request->getQuery('fileId');
	if($this->request->getQuery('versionId'))
	{
		$this->versionId = (int)$this->request->getQuery('versionId');
	}

	$this->file = File::loadById($this->fileId, array('STORAGE'));
	if(!$this->file)
	{
		$this->errorCollection->addOne(new Error(Loc::getMessage('DISK_DOWNLOAD_CONTROLLER_ERROR_COULD_NOT_FIND_FILE'), self::ERROR_COULD_NOT_FIND_FILE));

		return new EventResult(EventResult::ERROR);
	}

	if($this->file instanceof FileLink && !$this->file->getRealObject())
	{
		$this->errorCollection->addOne(new Error(Loc::getMessage('DISK_DOWNLOAD_CONTROLLER_ERROR_COULD_NOT_FIND_FILE'), self::ERROR_COULD_NOT_FIND_REAL_FILE));

		return new EventResult(EventResult::ERROR);
	}
	//todo refactor. The method send response. It's bad.
	$this->checkPermissions();

	return new EventResult(EventResult::SUCCESS);
}