• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/documentcontroller.php
  • Класс: BitrixDiskDocumentDocumentController
  • Вызов: DocumentController::processActionDiscard
protected function processActionDiscard()
{
	$this->checkRequiredPostParams(array(
		'editSessionId'
	));
	if($this->errorCollection->hasErrors())
	{
		$this->sendJsonErrorResponse();
	}

	$currentSession = $this->getEditSessionByCurrentUser((int)$this->request->getPost('editSessionId'));
	if(!$currentSession)
	{
		$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_EDIT_SESSION'), self::ERROR_COULD_NOT_FIND_EDIT_SESSION)));
		$this->sendJsonErrorResponse();
	}
	if(!$this->deleteEditSession($currentSession))
	{
		$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_DELETE_SESSION'), self::ERROR_COULD_NOT_FIND_DELETE_SESSION)));
		$this->sendJsonErrorResponse();
	}

	$fileData = new FileData();
	$fileData->setId($currentSession->getServiceFileId());

	if($currentSession->isExclusive())
	{
		$this->deleteFile($currentSession, $fileData);
	}
	else
	{
		$this->initializeFile($currentSession->getObjectId());
		if ($this->isLastEditSessionForFile())
		{
			$this->deleteFile($currentSession, $fileData);
		}
	}

	$this->sendJsonSuccessResponse();
}