From 055b32777e496e8e0d0c1c38cc948e8e93f4da41 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 14 Aug 2023 17:00:47 +0200 Subject: [PATCH] Fix typo in `UploadHandler` methods see https://www.woltlab.com/community/thread/301108-uploadhandler-mit-falschem-methodennamen/ --- .../files/lib/acp/form/StyleAddForm.class.php | 4 ++-- .../lib/acp/form/UserRankAddForm.class.php | 2 +- .../file/upload/UploadHandler.class.php | 22 ++++++++++++++++--- .../builder/field/UploadFormField.class.php | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php index 1fc290d67d..9d8b370e2e 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php @@ -400,7 +400,7 @@ class StyleAddForm extends AbstractForm $this->uploads = []; foreach (\array_keys($this->getUploadFields()) as $field) { - $removedFiles = UploadHandler::getInstance()->getRemovedFiledByFieldId($field); + $removedFiles = UploadHandler::getInstance()->getRemovedFilesByFieldId($field); if (!empty($removedFiles)) { $this->uploads[$field] = null; } @@ -412,7 +412,7 @@ class StyleAddForm extends AbstractForm } $this->customAssets = [ - 'removed' => UploadHandler::getInstance()->getRemovedFiledByFieldId('customAssets'), + 'removed' => UploadHandler::getInstance()->getRemovedFilesByFieldId('customAssets'), 'added' => UploadHandler::getInstance()->getFilesByFieldId('customAssets'), ]; } diff --git a/wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php index e7b40a9834..64a005b668 100644 --- a/wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php @@ -181,7 +181,7 @@ class UserRankAddForm extends AbstractForm $this->hideTitle = \intval($_POST['hideTitle']); } - $this->removedRankImages = UploadHandler::getInstance()->getRemovedFiledByFieldId('rankImage'); + $this->removedRankImages = UploadHandler::getInstance()->getRemovedFilesByFieldId('rankImage'); $rankImageFiles = UploadHandler::getInstance()->getFilesByFieldId('rankImage'); $this->rankImageFile = \reset($rankImageFiles); } diff --git a/wcfsetup/install/files/lib/system/file/upload/UploadHandler.class.php b/wcfsetup/install/files/lib/system/file/upload/UploadHandler.class.php index c664575006..fa0a77f478 100644 --- a/wcfsetup/install/files/lib/system/file/upload/UploadHandler.class.php +++ b/wcfsetup/install/files/lib/system/file/upload/UploadHandler.class.php @@ -136,13 +136,21 @@ class UploadHandler extends SingletonFactory * * @throws \InvalidArgumentException if the given fieldId is unknown */ - public function getRemovedFiledByFieldId($fieldId, $processFiles = true) + public function getRemovedFilesByFieldId($fieldId, $processFiles = true) { if (!isset($this->fields[$fieldId])) { throw new \InvalidArgumentException('UploadField with the id "' . $fieldId . '" is unknown.'); } - return $this->getRemovedFiledByInternalId($this->fields[$fieldId]->getInternalId(), $processFiles); + return $this->getRemovedFilesByInternalId($this->fields[$fieldId]->getInternalId(), $processFiles); + } + + /** + * @deprecated 6.0 This method exists only because of a spelling error in the method name. Use `getRemovedFiledByFieldId` instead. + */ + public function getRemovedFiledByFieldId($fieldId, $processFiles = true) + { + return $this->getRemovedFilesByFieldId($fieldId, $processFiles); } /** @@ -152,7 +160,7 @@ class UploadHandler extends SingletonFactory * @param bool $processFiles * @return UploadFile[] */ - public function getRemovedFiledByInternalId($internalId, $processFiles = true) + public function getRemovedFilesByInternalId($internalId, $processFiles = true) { if (isset($this->getStorage()[$internalId])) { $files = $this->getStorage()[$internalId]['removedFiles']; @@ -175,6 +183,14 @@ class UploadHandler extends SingletonFactory return []; } + /** + * @deprecated 6.0 This method exists only because of a spelling error in the method name. Use `getRemovedFilesByInternalId` instead. + */ + public function getRemovedFiledByInternalId($internalId, $processFiles = true) + { + return $this->getRemovedFilesByInternalId($internalId, $processFiles); + } + /** * Removes a file from the upload. * diff --git a/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php index c66163dd5e..785111706f 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php @@ -185,7 +185,7 @@ class UploadFormField extends AbstractFormField $this->registerField(); } - return UploadHandler::getInstance()->getRemovedFiledByFieldId($this->getPrefixedId(), $processFiles); + return UploadHandler::getInstance()->getRemovedFilesByFieldId($this->getPrefixedId(), $processFiles); } /** -- 2.20.1