Fix typo in `UploadHandler` methods
authorMarcel Werk <burntime@woltlab.com>
Mon, 14 Aug 2023 15:00:47 +0000 (17:00 +0200)
committerMarcel Werk <burntime@woltlab.com>
Mon, 14 Aug 2023 15:00:47 +0000 (17:00 +0200)
see https://www.woltlab.com/community/thread/301108-uploadhandler-mit-falschem-methodennamen/

wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php
wcfsetup/install/files/lib/system/file/upload/UploadHandler.class.php
wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php

index 1fc290d67d4d7105cafb814b0c794b00f0c97834..9d8b370e2e2682bf0afd2c237390b1cf7c564d6c 100644 (file)
@@ -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'),
         ];
     }
index e7b40a9834281cca8a347bb853c7a06421d0972b..64a005b6688ed52bf80726c78cab377b4e72ea5e 100644 (file)
@@ -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);
     }
index c664575006f8062ff52212849375163035c42938..fa0a77f478ee097aadbc704aeda605cfafcb4751 100644 (file)
@@ -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.
      *
index c66163dd5ee37e9d25270ba21f7845946a6d6853..785111706f1085940faeffb267630b15bd20d229 100644 (file)
@@ -185,7 +185,7 @@ class UploadFormField extends AbstractFormField
             $this->registerField();
         }
 
-        return UploadHandler::getInstance()->getRemovedFiledByFieldId($this->getPrefixedId(), $processFiles);
+        return UploadHandler::getInstance()->getRemovedFilesByFieldId($this->getPrefixedId(), $processFiles);
     }
 
     /**