From ef495799113d422781b2b37eb9c95d55626bcb59 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 12 Aug 2018 07:53:57 +0200 Subject: [PATCH] Add event in `DefaultUploadFileSaveStrategy::generateThumbnails()` Close #2621 --- .../DefaultUploadFileSaveStrategy.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php b/wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php index f906b0e810..5b2f50e53e 100644 --- a/wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php +++ b/wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php @@ -5,6 +5,7 @@ use wcf\data\DatabaseObjectEditor; use wcf\data\IDatabaseObjectAction; use wcf\data\IFile; use wcf\data\IThumbnailFile; +use wcf\system\event\EventHandler; use wcf\system\exception\ImplementationException; use wcf\system\exception\ParentClassException; use wcf\system\exception\SystemException; @@ -267,6 +268,20 @@ class DefaultUploadFileSaveStrategy implements IUploadFileSaveStrategy { } } + $parameters = [ + 'file' => $file, + 'updateData' => $updateData + ]; + + EventHandler::getInstance()->fireAction($this, 'generateThumbnails', $parameters); + + if (!is_array($parameters['updateData'])) { + throw new \UnexpectedValueException('$updateData is no longer an array after being manipulated by event listeners.'); + } + else { + $updateData = $parameters['updateData']; + } + if (!empty($updateData)) { /** @noinspection PhpUndefinedMethodInspection */ (new $this->editorClassName($file))->update($updateData); -- 2.20.1