From: Tim Düsterhus Date: Fri, 18 Nov 2022 09:52:10 +0000 (+0100) Subject: Replace `PackageArchive::getUpdateInstructions()` with `getAllUpdateInstructions()` X-Git-Tag: 6.0.0_Alpha_1~698^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eee89934e17ba20e5a55b739ee0533553349bf4d;p=GitHub%2FWoltLab%2FWCF.git Replace `PackageArchive::getUpdateInstructions()` with `getAllUpdateInstructions()` The filtering of update instructions is a massive design mistake is now effectively removed. The method is renamed, because the behavior changed quite a bit. Better fail obviously than silently returning garbage. Fixes #5094 --- diff --git a/wcfsetup/install/files/lib/acp/form/DevtoolsProjectEditForm.class.php b/wcfsetup/install/files/lib/acp/form/DevtoolsProjectEditForm.class.php index 0d9e1aac0e..6fba900e02 100644 --- a/wcfsetup/install/files/lib/acp/form/DevtoolsProjectEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/DevtoolsProjectEditForm.class.php @@ -311,7 +311,7 @@ class DevtoolsProjectEditForm extends DevtoolsProjectAddForm ], ]; - foreach ($packageArchive->getUpdateInstructions() as $fromVersion => $updateInstructions) { + foreach ($packageArchive->getAllUpdateInstructions() as $fromVersion => $updateInstructions) { $versionUpdateInstructions = []; foreach ($updateInstructions as $instruction) { diff --git a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php index 41f3c1f6de..6c42ec35c5 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -586,12 +586,8 @@ class PackageArchive * * @return array */ - public function getUpdateInstructions() + public function getAllUpdateInstructions() { - if ($this->package !== null && $this->package->packageVersion !== null) { - $this->filterUpdateInstructions(); - } - return $this->instructions['update']; } diff --git a/wcfsetup/install/files/lib/system/package/PackageManifest.class.php b/wcfsetup/install/files/lib/system/package/PackageManifest.class.php index f53520f496..a9be9584f8 100644 --- a/wcfsetup/install/files/lib/system/package/PackageManifest.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageManifest.class.php @@ -186,7 +186,7 @@ final class PackageManifest private function getUpdateInstructions(): array { - $updateInstructions = $this->archive->getUpdateInstructions(); + $updateInstructions = $this->archive->getAllUpdateInstructions(); \ksort($updateInstructions); return \array_map($this->cleanInstructions(...), $updateInstructions);