- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/bitrix24disk/legacy/diskstorage.php
- Класс: BitrixDiskBitrix24DiskLegacyDiskStorage
- Вызов: DiskStorage::formatFileToResponse
protected function formatFileToResponse(File $file)
{
if(empty($file) || $file->getName() == '')
{
return array();
}
$path = $this->getPathByObject($file);
if(!$path)
{
return array();
}
$this->loadSharedData();
$dateTime = $this->getUpdateDateTimeFromObject($file);
$result = array(
'id' => $this->generateId(array('FILE' => true, 'ID' => $file->getId())),
'isDirectory' => false,
'isShared' => $this->isSharedObject($file->getId()),
'isSymlinkFile' => $file->isLink(),
'isDeleted' => $file->isDeleted(),
'storageId' => $this->getStringStorageId(),
'path' => '/' . trim($path, '/'),
'name' => (string)$file->getName(),
'revision' => $file->getFileId(),
'etag' => $file->getEtag()?: null,
'version' => (string)$this->generateTimestamp($file->getSyncUpdateTime()->getTimestamp()),
'originalTimestamp' => (string)$this->generateTimestamp($dateTime->getTimestamp()),
'extra' => array(
'id' => (string)$file->getId(),
'iblockId' => (string)$file->getStorageId(),
'sectionId' => (string)$file->getParentId(),
'rootSectionId' => (string)$this->storage->getRootObjectId(),
'name' => (string)$file->getName(),
),
'size' => (string)$file->getSize(),
'permission' => 'W',
'createdBy' => (string)$file->getCreatedBy(),
'modifiedBy' => (string)$file->getUpdatedBy(),
);
if($this->storage->getRootObjectId() != $file->getParentId())
{
$result['parentId'] = $this->generateId(array('FILE' => false, 'ID' => $file->getParentId()));
}
if($this->isEnabledObjectLock)
{
$lock = $file->getLock();
if($lock)
{
$result['lock'] = array(
'createdBy' => (string)$lock->getCreatedBy(),
'createTimestamp' => (string)$this->generateTimestamp($lock->getCreateTime()->getTimestamp()),
'canUnlock' => $lock->canUnlock($this->getUser()->getId()),
);
}
}
return $result;
}