From d2f94ec7683c613a4c432ab75bf2582584e42bcd Mon Sep 17 00:00:00 2001 From: NSO73 <108399823+NSO73@users.noreply.github.com> Date: Tue, 16 Jun 2026 03:06:41 +0200 Subject: [PATCH 1/4] fix: explicit nullable types for PHP 8.4 compatibility PHP 8.4 deprecates implicitly marking parameters as nullable (Type $param = null). Make the nullable type explicit (?Type) for the $password parameters in DocumentConverter, ConverterBinary and DocumentStore. Signed-off-by: NSO73 <108399823+NSO73@users.noreply.github.com> --- lib/Document/ConverterBinary.php | 2 +- lib/Document/DocumentStore.php | 2 +- lib/DocumentConverter.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Document/ConverterBinary.php b/lib/Document/ConverterBinary.php index 47a44d2..964c5b3 100644 --- a/lib/Document/ConverterBinary.php +++ b/lib/Document/ConverterBinary.php @@ -34,7 +34,7 @@ public function __construct(LoggerInterface $logger) { $this->logger = $logger; } - public function run(string $param, string $password = null): string { + public function run(string $param, ?string $password = null): string { if (!is_executable(self::BINARY_DIRECTORY . '/x2t')) { @chmod(self::BINARY_DIRECTORY . '/x2t', 0755); } diff --git a/lib/Document/DocumentStore.php b/lib/Document/DocumentStore.php index b5905ef..c0c1911 100644 --- a/lib/Document/DocumentStore.php +++ b/lib/Document/DocumentStore.php @@ -73,7 +73,7 @@ private function getDocumentFolder(int $documentId): ISimpleFolder { } } - public function getDocumentForEditor(int $documentId, File $sourceFile, string $sourceFormat, string $password = null): ISimpleFile { + public function getDocumentForEditor(int $documentId, File $sourceFile, string $sourceFormat, ?string $password = null): ISimpleFile { $docFolder = $this->getDocumentFolder($documentId); try { return $docFolder->getFile('Editor.bin'); diff --git a/lib/DocumentConverter.php b/lib/DocumentConverter.php index babed28..e9b7d8e 100644 --- a/lib/DocumentConverter.php +++ b/lib/DocumentConverter.php @@ -42,7 +42,7 @@ public function __construct(ITempManager $tempManager, ConverterBinary $converte $this->converter = $converterBinary; } - public function getEditorBinary($source, string $sourceExtension, string $targetFolder, string $password = null) { + public function getEditorBinary($source, string $sourceExtension, string $targetFolder, ?string $password = null) { $sourceFile = $this->tempManager->getTemporaryFile(".$sourceExtension"); file_put_contents($sourceFile, $source); @@ -106,14 +106,14 @@ private function rmdirr($path) { } - public function convertFiles(string $from, string $to, int $targetFormat = DocumentFormat::AVS_OFFICESTUDIO_FILE_CANVAS, string $password = null) { + public function convertFiles(string $from, string $to, int $targetFormat = DocumentFormat::AVS_OFFICESTUDIO_FILE_CANVAS, ?string $password = null) { $command = new ConvertCommand($from, $to); $command->setTargetFormat($targetFormat); $this->runCommand($command, $password); } - public function runCommand(ConvertCommand $command, string $password = null) { + public function runCommand(ConvertCommand $command, ?string $password = null) { $xmlFile = $this->tempManager->getTemporaryFile('.xml'); $xmlWriter = new Writer(); $xmlWriter->namespaceMap["http://www.w3.org/2001/XMLSchema-instance"] = "xsi"; From 335ce64d32fcbd8c15474972e2a863983ad4c1fe Mon Sep 17 00:00:00 2001 From: NSO73 <108399823+NSO73@users.noreply.github.com> Date: Tue, 16 Jun 2026 03:51:33 +0200 Subject: [PATCH 2/4] fix: support onlyoffice connector >= 10.1 (AppConfig signature change) The onlyoffice connector 10.1 expanded AppConfig::__construct from (string, IConfig, LoggerInterface, ICacheFactory) to (string, IAppConfig, IConfig, IUserConfig, LoggerInterface, ICacheFactory), which made documentserver_community fail to boot with a TypeError. Detect the constructor arity at runtime and pass the matching arguments, keeping compatibility with older connector versions (<= 10.0) and the Nextcloud versions that ship them. Signed-off-by: NSO73 <108399823+NSO73@users.noreply.github.com> --- lib/AppInfo/Application.php | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index f0a6769..891f137 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -62,7 +62,7 @@ public function register(IRegistrationContext $context): void { $context->registerService(URLDecoder::class, function (IAppContainer $container) { $server = $container->getServer(); - $appConfig = new AppConfig('onlyoffice', \OC::$server->getConfig(), \OCP\Log\logger('onlyoffice'), \OC::$server->get(ICacheFactory::class)); + $appConfig = $this->buildAppConfig(); $crypto = new Crypt($appConfig); return new URLDecoder( @@ -75,7 +75,7 @@ public function register(IRegistrationContext $context): void { $context->registerService(AutoConfig::class, function (IAppContainer $container) { $server = $container->getServer(); - $appConfig = new AppConfig('onlyoffice', \OC::$server->getConfig(), \OCP\Log\logger('onlyoffice'), \OC::$server->get(ICacheFactory::class)); + $appConfig = $this->buildAppConfig(); return new AutoConfig( $server->get(IURLGenerator::class), $appConfig @@ -83,6 +83,35 @@ public function register(IRegistrationContext $context): void { }); } + /** + * Build an onlyoffice AppConfig instance regardless of the connector version. + * + * The onlyoffice connector changed AppConfig's constructor signature over + * time: up to 10.0 it was (string, IConfig, LoggerInterface, ICacheFactory); + * from 10.1 it became (string, IAppConfig, IConfig, IUserConfig, + * LoggerInterface, ICacheFactory). Detect the arity and pass accordingly so + * this app keeps booting across connector and Nextcloud versions. + */ + private function buildAppConfig(): AppConfig { + $config = \OC::$server->getConfig(); + $logger = \OCP\Log\logger('onlyoffice'); + $cacheFactory = \OC::$server->get(ICacheFactory::class); + + $paramCount = (new \ReflectionMethod(AppConfig::class, '__construct'))->getNumberOfParameters(); + if ($paramCount >= 6) { + return new AppConfig( + 'onlyoffice', + \OC::$server->get(\OCP\IAppConfig::class), + $config, + \OC::$server->get(\OCP\Config\IUserConfig::class), + $logger, + $cacheFactory + ); + } + + return new AppConfig('onlyoffice', $config, $logger, $cacheFactory); + } + public function boot(IBootContext $context): void { $context->injectFn(function (IAppManager $appManager) { if ($appManager->isEnabledForUser('onlyoffice')) { From fbc8112ce4ce82b74e2b74e1d55c060b044ad123 Mon Sep 17 00:00:00 2001 From: NSO73 <108399823+NSO73@users.noreply.github.com> Date: Mon, 13 Jul 2026 18:52:10 +0200 Subject: [PATCH 3/4] Fix getConfig() deprecation removed on Nextcloud 34 Resolve IConfig through the DI container instead of the deprecated \OC::$server->getConfig(), which is gone on NC34. Same service, no behaviour change. Credit to sjs6776 and defame-flagstick. Signed-off-by: NSO73 <108399823+NSO73@users.noreply.github.com> --- lib/AppInfo/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 891f137..f78c51c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -93,7 +93,7 @@ public function register(IRegistrationContext $context): void { * this app keeps booting across connector and Nextcloud versions. */ private function buildAppConfig(): AppConfig { - $config = \OC::$server->getConfig(); + $config = \OC::$server->get(\OCP\IConfig::class); $logger = \OCP\Log\logger('onlyoffice'); $cacheFactory = \OC::$server->get(ICacheFactory::class); From 9912f1a7e6b7cc26c5b1d09dde2898f291d1867e Mon Sep 17 00:00:00 2001 From: NSO73 <108399823+NSO73@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:59:52 +0200 Subject: [PATCH 4/4] Allow installation on Nextcloud 34 Bump max-version to 34 now that the boot failures on NC 34 (getConfig() removal, AppConfig signature change) are fixed. Signed-off-by: NSO73 <108399823+NSO73@users.noreply.github.com> --- appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index d3fceee..ccbce02 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -31,7 +31,7 @@ Additionally, the community document server only supports running on x86-64 Linu https://raw.githubusercontent.com/nextcloud/documentserver_community/master/screenshots/main.png https://raw.githubusercontent.com/nextcloud/documentserver_community/master/screenshots/new.png - +