summaryrefslogtreecommitdiffstats
path: root/lib/private/PreviewManager.php
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-07-03 12:02:31 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-07-05 13:57:46 +0200
commit4505afe18478274fcdbaf55109a7fbd6699f71de (patch)
tree25cfb812615ae1ef51b86222dda3771e5c3cff50 /lib/private/PreviewManager.php
parenteaabe97373baa68b5e3c396bf8e1f5a3f17ac1b6 (diff)
downloadnextcloud-server-4505afe18478274fcdbaf55109a7fbd6699f71de.tar.gz
nextcloud-server-4505afe18478274fcdbaf55109a7fbd6699f71de.zip
Allow IProviderV2 for previews as well
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/PreviewManager.php')
-rw-r--r--lib/private/PreviewManager.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php
index 6635d919fb7..621c45f28c5 100644
--- a/lib/private/PreviewManager.php
+++ b/lib/private/PreviewManager.php
@@ -35,7 +35,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IConfig;
use OCP\IPreview;
-use OCP\Preview\IProvider;
+use OCP\Preview\IProviderV2;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class PreviewManager implements IPreview {
@@ -53,6 +53,9 @@ class PreviewManager implements IPreview {
/** @var Generator */
private $generator;
+
+ /** @var GeneratorHelper */
+ private $helper;
/** @var bool */
protected $providerListDirty = false;
@@ -85,11 +88,13 @@ class PreviewManager implements IPreview {
IRootFolder $rootFolder,
IAppData $appData,
EventDispatcherInterface $eventDispatcher,
+ GeneratorHelper $helper,
$userId) {
$this->config = $config;
$this->rootFolder = $rootFolder;
$this->appData = $appData;
$this->eventDispatcher = $eventDispatcher;
+ $this->helper = $helper;
$this->userId = $userId;
}
@@ -255,9 +260,9 @@ class PreviewManager implements IPreview {
foreach ($this->providers as $supportedMimeType => $providers) {
if (preg_match($supportedMimeType, $file->getMimetype())) {
- foreach ($providers as $closure) {
- $provider = $closure();
- if (!($provider instanceof IProvider)) {
+ foreach ($providers as $providerClosure) {
+ $provider = $this->helper->getProvider($providerClosure);
+ if (!($provider instanceof IProviderV2)) {
continue;
}