Store office suite choice in a single config option

Previously it was three boolean options, which were supposed to be mutually
exclusive, which had to be taken care of manually.

Also previously there was only indirect indication of the choice "none", which
is brittle, too.

Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
Pablo Zmdl
2026-07-17 19:24:49 +02:00
parent 4285168457
commit fd4e0ddcb2
8 changed files with 121 additions and 115 deletions
+5 -18
View File
@@ -5,6 +5,7 @@ namespace AIO\Controller;
use AIO\Data\ConfigurationManager;
use AIO\Data\InvalidSettingConfigurationException;
use AIO\Data\OfficeSuite;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
@@ -76,24 +77,10 @@ readonly class ConfigurationController {
}
if (isset($request->getParsedBody()['options-form'])) {
$officeSuiteChoice = $request->getParsedBody()['office_suite_choice'] ?? '';
if ($officeSuiteChoice === 'collabora') {
$this->configurationManager->isCollaboraEnabled = true;
$this->configurationManager->isOnlyofficeEnabled = false;
$this->configurationManager->isEuroofficeEnabled = false;
} elseif ($officeSuiteChoice === 'onlyoffice') {
$this->configurationManager->isCollaboraEnabled = false;
$this->configurationManager->isOnlyofficeEnabled = true;
$this->configurationManager->isEuroofficeEnabled = false;
} elseif ($officeSuiteChoice === 'eurooffice') {
$this->configurationManager->isCollaboraEnabled = false;
$this->configurationManager->isOnlyofficeEnabled = false;
$this->configurationManager->isEuroofficeEnabled = true;
} else {
$this->configurationManager->isCollaboraEnabled = false;
$this->configurationManager->isOnlyofficeEnabled = false;
$this->configurationManager->isEuroofficeEnabled = false;
if (isset($request->getParsedBody()['office_suite_choice'])) {
$inputValue = strval($request->getParsedBody()['office_suite_choice'] ?? '');
$officeSuite = OfficeSuite::tryFrom($inputValue) ?? OfficeSuite::None;
$this->configurationManager->officeSuite = $officeSuite;
}
$this->configurationManager->isClamavEnabled = isset($request->getParsedBody()['clamav']);
$this->configurationManager->isTalkEnabled = isset($request->getParsedBody()['talk']);
+2 -1
View File
@@ -11,6 +11,7 @@ use AIO\Docker\DockerActionManager;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use AIO\Data\ConfigurationManager;
use AIO\Data\OfficeSuite;
use Slim\Psr7\NonBufferedBody;
readonly class DockerController {
@@ -299,7 +300,7 @@ readonly class DockerController {
// This is a hack but no better solution was found for the meantime
// Stop Collabora first to make sure it force-saves
// See https://github.com/nextcloud/richdocuments/issues/3799
if ($id === self::TOP_CONTAINER && $this->configurationManager->isCollaboraEnabled) {
if ($id === self::TOP_CONTAINER && $this->configurationManager->officeSuite === OfficeSuite::Collabora) {
$this->PerformRecursiveContainerStop('nextcloud-aio-collabora', false, $addToStreamingResponseBody);
}