Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/private/PreviewManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function __construct(
* @param string $mimeTypeRegex Regex with the mime types that are supported by this provider
* @param ProviderClosure $callable
*/
public function registerProvider(string $mimeTypeRegex, Closure $callable): void {
private function registerProviderClosure(string $mimeTypeRegex, Closure $callable): void {
if (!$this->enablePreviews) {
return;
}
Expand Down Expand Up @@ -293,7 +293,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);
});
}
Expand Down Expand Up @@ -419,7 +420,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) {
Expand Down
15 changes: 0 additions & 15 deletions lib/public/IPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<string, list<ProviderClosure>>
Expand Down
Loading