Skip to content

Commit

Permalink
Merge pull request #5625 from WoltLab/upload-handler-methods-typ
Browse files Browse the repository at this point in the history
Fix typo in `UploadHandler` methods
  • Loading branch information
BurntimeX authored Aug 14, 2023
2 parents 2b70552 + 055b327 commit cd9f545
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ public function readFormParameters()

$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;
}
Expand All @@ -412,7 +412,7 @@ public function readFormParameters()
}

$this->customAssets = [
'removed' => UploadHandler::getInstance()->getRemovedFiledByFieldId('customAssets'),
'removed' => UploadHandler::getInstance()->getRemovedFilesByFieldId('customAssets'),
'added' => UploadHandler::getInstance()->getFilesByFieldId('customAssets'),
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function readFormParameters()
$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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,21 @@ public function getFilesByFieldId($fieldId)
*
* @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);
}

/**
Expand All @@ -152,7 +160,7 @@ public function getRemovedFiledByFieldId($fieldId, $processFiles = true)
* @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'];
Expand All @@ -175,6 +183,14 @@ public function getRemovedFiledByInternalId($internalId, $processFiles = true)
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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function getRemovedFiles($processFiles = false)
$this->registerField();
}

return UploadHandler::getInstance()->getRemovedFiledByFieldId($this->getPrefixedId(), $processFiles);
return UploadHandler::getInstance()->getRemovedFilesByFieldId($this->getPrefixedId(), $processFiles);
}

/**
Expand Down

0 comments on commit cd9f545

Please sign in to comment.