• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/bitrix24disk/legacy/diskstorage.php
  • Класс: BitrixDiskBitrix24DiskLegacyDiskStorage
  • Вызов: DiskStorage::moveFile
public function moveFile($name, $targetElementId, $newParentDirectoryId)
{
	if(!$newParentDirectoryId)
	{
		$parentFolder = $this->storage->getRootObject();
	}
	else
	{
		$parentFolder = Folder::loadById($newParentDirectoryId);
	}

	/** @var File $sourceFile */
	$sourceFile = File::loadById($targetElementId);
	if(!$sourceFile || !$parentFolder)
	{
		$this->errorCollection->add(array(new Error("Could not " . __METHOD__ . " by id {$targetElementId}", 11150)));
		return false;
	}

	if(!$sourceFile->canMove($this->storage->getSecurityContext($this->userId), $parentFolder))
	{
		throw new AccessDeniedException;
	}

	$movedFile = $sourceFile->moveTo($parentFolder, $this->getUser()->getId());
	if($movedFile)
	{
		$this->loadTree();
		return $this->getFile(null, array('id' => $movedFile->getId()), true);
	}
	$this->errorCollection->add(array(new Error("Could not " . __METHOD__ . ", moveTo to {$targetElementId}", 11151)));
	$this->errorCollection->add($sourceFile->getErrors());

	return array();
}