- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/webdavstorage.php
- Класс: CWebDavStorageCore
- Вызов: CWebDavStorageCore::updateFile
public function updateFile($name, $targetElementId, CWebDavTmpFile $tmpFile)
{
$this->init();
$name = $this->getWebDav()->correctName($name);
if(!$this->checkRights('update', array(
'name' => $name,
'targetElementId' => $targetElementId)))
{
throw new CWebDavAccessDeniedException;
}
$options = array(
'new' => false,
'FILE_NAME' => $name,
'ELEMENT_ID' => $targetElementId,
'arUserGroups' => $this->getWebDav()->USER['GROUPS'],
'TMP_FILE' => $tmpFile->getAbsolutePath(),
'WIDTH' => $tmpFile->width,
'HEIGHT' => $tmpFile->height,
);
$this->getDb()->startTransaction();
if (!$this->getWebDav()->put_commit($options))
{
$this->getDb()->rollback();
$tmpFile->delete();
return false;
}
$this->getDb()->commit();
$tmpFile->delete();
if(!empty($options['ELEMENT_ID']))
{
$file = $this->getFile(null, array('id' => $options['ELEMENT_ID']), true);
if($file)
{
return $file;
}
}
throw new WebDavStorageBreakDownException('bd updateFile');
}