- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/bitrix24disk/legacy/storagecontroller.php
- Класс: BitrixDiskBitrix24DiskLegacyStorageController
- Вызов: StorageController::processActionDownload
protected function processActionDownload()
{
$this->checkRequiredPostParams(array('id', 'version', 'extra', 'storageExtra', 'storageId'));
if($this->errorCollection->hasErrors())
{
$this->sendJsonErrorResponse();
}
$id = $this->request->getPost('id');
$version = $this->request->getPost('version');
$storage = $this->getStorageObject($this->request->getPost('storageExtra'), $this->request->getPost('storageId'));
$extra = $storage->parseElementExtra($this->request->getPost('extra'));
$file = $storage->getFile($id, $extra);
//not found or we have new version
if (!$file || !isset($file['version']))
{
$this->sendJsonResponse(array(
'status' => static::STATUS_NOT_FOUND,
));
}
elseif ($storage->compareVersion($file['version'], $version) != 0)
{
$this->sendJsonResponse([
'status' => static::STATUS_NOT_FOUND,
'file' => $file,
]);
}
else
{
if(!$storage->sendFile($file))
{
$this->sendJsonResponse(array(
'status' => static::STATUS_NOT_FOUND,
'message' => 'Not found source file',
));
}
}
}