• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/attachedobject.php
  • Класс: BitrixDiskAttachedObject
  • Вызов: AttachedObject::delete
public function delete()
{
	$success = $this->deleteInternal();

	if(!$success)
	{
		return false;
	}

	TrackedObjectTable::deleteBatch([
		'ATTACHED_OBJECT_ID' => $this->id,
	]);

	if($this->isSpecificVersion())
	{
		return false;
	}

	$file = $this->getFile();

	if(
		$file &&
		$file->getGlobalContentVersion() == 1 &&
		$file->countAttachedObjects() == 0 &&
		$file->getParent() &&
		$file->getParent()->getCode() === Folder::CODE_FOR_UPLOADED_FILES
	)
	{
		$file->delete(SystemUser::SYSTEM_USER_ID);
	}

	return $success;
}