Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Preview/Generator.php')
-rw-r--r--lib/private/Preview/Generator.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php
index ef44188da74..a49cc8e522e 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -29,6 +29,7 @@
*/
namespace OC\Preview;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\File;
use OCP\Files\IAppData;
use OCP\Files\InvalidPathException;
@@ -40,6 +41,7 @@ use OCP\IConfig;
use OCP\IImage;
use OCP\IPreview;
use OCP\IStreamImage;
+use OCP\Preview\BeforePreviewFetchedEvent;
use OCP\Preview\IProviderV2;
use OCP\Preview\IVersionedPreviewFile;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -56,26 +58,23 @@ class Generator {
/** @var GeneratorHelper */
private $helper;
/** @var EventDispatcherInterface */
+ private $legacyEventDispatcher;
+ /** @var IEventDispatcher */
private $eventDispatcher;
- /**
- * @param IConfig $config
- * @param IPreview $previewManager
- * @param IAppData $appData
- * @param GeneratorHelper $helper
- * @param EventDispatcherInterface $eventDispatcher
- */
public function __construct(
IConfig $config,
IPreview $previewManager,
IAppData $appData,
GeneratorHelper $helper,
- EventDispatcherInterface $eventDispatcher
+ EventDispatcherInterface $legacyEventDispatcher,
+ IEventDispatcher $eventDispatcher
) {
$this->config = $config;
$this->previewManager = $previewManager;
$this->appData = $appData;
$this->helper = $helper;
+ $this->legacyEventDispatcher = $legacyEventDispatcher;
$this->eventDispatcher = $eventDispatcher;
}
@@ -102,10 +101,14 @@ class Generator {
'crop' => $crop,
'mode' => $mode,
];
- $this->eventDispatcher->dispatch(
+
+ $this->legacyEventDispatcher->dispatch(
IPreview::EVENT,
new GenericEvent($file, $specification)
);
+ $this->eventDispatcher->dispatchTyped(new BeforePreviewFetchedEvent(
+ $file
+ ));
// since we only ask for one preview, and the generate method return the last one it created, it returns the one we want
return $this->generatePreviews($file, [$specification], $mimeType);