- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/controller/onlyoffice.php
- Класс: BitrixDiskControllerOnlyOffice
- Вызов: OnlyOffice::handleOnlyOfficeAction
public function handleOnlyOfficeAction(ModelsDocumentSession $documentSession, JsonPayload $payload): ?ResponseJson
{
$this->enableExtendedErrorInfo();
$payloadData = $payload->getData();
$status = $payloadData['status'];
$this->processRestrictionLogs($status, $payloadData);
Application::getInstance()->addBackgroundJob(function () use ($status, $documentSession){
$this->processStatusToInfoModel($documentSession, $status);
});
$this->logUsageMetrics($documentSession, $payloadData);
switch ($status)
{
case self::STATUS_IS_BEING_EDITED:
$this->handleDocumentIsEditing($documentSession, $payloadData);
break;
case self::STATUS_IS_READY_FOR_SAVE:
case self::STATUS_ERROR_WHILE_SAVING:
if ($this->saveDocument($documentSession, $payloadData))
{
$this->deactivateDocumentSessions($documentSession->getExternalHash());
$this->commentAttachedObjectsOnBackground($documentSession);
}
break;
case self::STATUS_CLOSE_WITHOUT_CHANGES:
$this->handleDocumentClosedWithoutChanges($documentSession);
break;
case self::STATUS_FORCE_SAVE:
case self::STATUS_ERROR_WHILE_FORCE_SAVING:
$this->saveDocument($documentSession, $payloadData);
break;
}
$this->processStatusToInfoModel($documentSession, $status);
if ($documentSession->getInfo() && $documentSession->getInfo()->wasFinallySaved())
{
$this->sendEventToDocumentChannel($documentSession);
}
if ($this->getErrors())
{
return null;
}
return new ResponseJson(['error' => 0]);
}