• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/controller/onlyoffice.php
  • Класс: BitrixDiskControllerOnlyOffice
  • Вызов: OnlyOffice::recoverSessionWithBrokenFileAction
public function recoverSessionWithBrokenFileAction(ModelsDocumentSession $session): ?array
{
	$documentInfo = $session->getInfo();
	if (!$documentInfo)
	{
		$this->addError(new Error("Session {$session->getId()} doesn't have info."));

		return null;
	}

	if ($documentInfo->isFinished())
	{
		$this->addError(new Error("Session {$session->getId()} is already finished."));

		return null;
	}

	$session->setAsBroken();
	ModelsDocumentSessionTable::markAsBrokenByHash($session->getExternalHash());

	$restoreDocumentInteractionUrl = UrlManager::getInstance()->createByController(new DocumentService(), 'restoreDocumentInteraction', [
		'documentSessionHash' => $session->getExternalHash(),
		'documentSessionId' => $session->getId(),
	]);

	return [
		'link' => $restoreDocumentInteractionUrl,
	];
}