- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/diskstorage.php
- Класс: CDiskStorage
- Вызов: CDiskStorage::renameFile
public function renameFile($name, $targetElementId, $parentDirectoryId)
{
/** @var File $sourceFile */
$sourceFile = File::loadById($targetElementId);
if(!$sourceFile)
{
$this->errorCollection->add(array(new Error("Could not " . __METHOD__ . " by id {$targetElementId}", 111604)));
return false;
}
if(!$sourceFile->canRename($this->storage->getCurrentUserSecurityContext()))
{
throw new CWebDavAccessDeniedException;
}
if($sourceFile->rename($name, $this->getUser()->getId()))
{
$this->loadFormattedFolderTreeAndBreadcrumbs();
return $this->getFile(null, array('id' => $sourceFile->getId()), true);
}
$this->errorCollection->add(array(new Error("Could not " . __METHOD__ . ", rename", 111605)));
$this->errorCollection->add($sourceFile->getErrors());
return array();
}