From eee89934e17ba20e5a55b739ee0533553349bf4d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 18 Nov 2022 10:52:10 +0100 Subject: [PATCH] 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 --- .../files/lib/acp/form/DevtoolsProjectEditForm.class.php | 2 +- .../files/lib/system/package/PackageArchive.class.php | 6 +----- .../files/lib/system/package/PackageManifest.class.php | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) 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); -- 2.20.1