• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/diskstorage.php
  • Класс: CDiskStorage
  • Вызов: CDiskStorage::moveDirectory
public function moveDirectory($name, $targetDirectoryId, $newParentDirectoryId)
{
	if(!$newParentDirectoryId)
	{
		$newParentFolder = $this->storage->getRootObject();
	}
	else
	{
		$newParentFolder = Folder::loadById($newParentDirectoryId);
	}
	/** @var Folder $sourceFolder */
	$sourceFolder = Folder::loadById($targetDirectoryId);
	if(!$sourceFolder || !$newParentFolder)
	{
		$this->errorCollection->add(array(new Error("Could not " . __METHOD__ . " by id {$targetDirectoryId}", 11148)));
		return false;
	}

	if(!$sourceFolder->canMove($this->storage->getCurrentUserSecurityContext(), $newParentFolder))
	{
		throw new CWebDavAccessDeniedException;
	}

	if($sourceFolder->moveTo($newParentFolder, $this->getUser()->getId()))
	{
		$this->loadFormattedFolderTreeAndBreadcrumbs();
		return $this->getDirectory(null, array('id' => $sourceFolder->getId()), true);
	}
	$this->errorCollection->add(array(new Error("Could not " . __METHOD__ . ", moveTo to {$targetDirectoryId}", 11149)));
	$this->errorCollection->add($sourceFolder->getErrors());
	return array();
}