Replace `PackageArchive::getUpdateInstructions()` with `getAllUpdateInstructions()`
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 18 Nov 2022 09:52:10 +0000 (10:52 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 18 Nov 2022 10:00:51 +0000 (11:00 +0100)
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

wcfsetup/install/files/lib/acp/form/DevtoolsProjectEditForm.class.php
wcfsetup/install/files/lib/system/package/PackageArchive.class.php
wcfsetup/install/files/lib/system/package/PackageManifest.class.php

index 0d9e1aac0e3f9b793def0c46868c988855efc906..6fba900e02f9e8e23c80fd7e0be32012e7764746 100644 (file)
@@ -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) {
index 41f3c1f6ded6a35ee82e322944763be226b157c0..6c42ec35c5f987701b9082d28d99bedcf09aa00e 100644 (file)
@@ -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'];
     }
 
index f53520f496d41568ecc568e27042649e2f5c6fc3..a9be9584f86ab613e77557a839bd9a3ca30d6066 100644 (file)
@@ -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);