diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 578c256aac068..3672d812095c0 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -107,8 +107,7 @@ public function __construct( * @param string $mimeTypeRegex Regex with the mime types that are supported by this provider * @param ProviderClosure $callable */ - #[\Override] - public function registerProvider(string $mimeTypeRegex, Closure $callable): void { + private function registerProviderClosure(string $mimeTypeRegex, Closure $callable): void { if (!$this->enablePreviews) { return; } @@ -300,7 +299,8 @@ protected function getEnabledDefaultProvider(): array { */ protected function registerCoreProvider(string $class, string $mimeType, array $options = []): void { if (in_array(trim($class, '\\'), $this->getEnabledDefaultProvider())) { - $this->registerProvider($mimeType, function () use ($class, $options) { + $this->registerProviderClosure($mimeType, function () use ($class, $options): IProviderV2 { + /** @var IProviderV2 $class */ return new $class($options); }); } @@ -426,7 +426,7 @@ private function registerBootstrapProviders(): void { } $this->loadedBootstrapProviders[$key] = null; - $this->registerProvider($provider->getMimeTypeRegex(), function () use ($provider): IProviderV2|false { + $this->registerProviderClosure($provider->getMimeTypeRegex(), function () use ($provider): IProviderV2|false { try { return $this->container->get($provider->getService()); } catch (NotFoundExceptionInterface) { diff --git a/lib/public/IPreview.php b/lib/public/IPreview.php index 56c31430f4959..b4ebf4a439f2d 100644 --- a/lib/public/IPreview.php +++ b/lib/public/IPreview.php @@ -5,8 +5,6 @@ * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ -// use OCP namespace for all classes that are considered public. -// This means that they should be used by apps instead of the internal Nextcloud classes namespace OCP; @@ -35,19 +33,6 @@ interface IPreview { */ public const MODE_COVER = 'cover'; - /** - * In order to improve lazy loading a closure can be registered which will be - * called in case preview providers are actually requested - * - * @param string $mimeTypeRegex Regex with the mime types that are supported by this provider - * @param ProviderClosure $callable - * @since 8.1.0 - * @see \OCP\AppFramework\Bootstrap\IRegistrationContext::registerPreviewProvider - * - * @deprecated 23.0.0 Register your provider via the IRegistrationContext when booting the app - */ - public function registerProvider(string $mimeTypeRegex, Closure $callable): void; - /** * Get all providers * @return array>