mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 02:00:51 -04:00
chore(previews): registerProvider->registerProviderClosure in PreviewManager
No longer part of the public interface. Just an internal utility function. Apps/etc register in other ways and still end up here appropriately. Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
parent
07bac538e2
commit
bf9d97ec5a
1 changed files with 3 additions and 4 deletions
|
|
@ -107,8 +107,7 @@ class PreviewManager implements IPreview {
|
|||
* @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,7 @@ class PreviewManager implements IPreview {
|
|||
*/
|
||||
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 {
|
||||
return new $class($options);
|
||||
});
|
||||
}
|
||||
|
|
@ -426,7 +425,7 @@ class PreviewManager implements IPreview {
|
|||
}
|
||||
$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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue