Take a package version instead of a package in PackageArchive::getUpdateInstructionsFor()
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 18 Nov 2022 09:21:42 +0000 (10:21 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 18 Nov 2022 09:44:22 +0000 (10:44 +0100)
wcfsetup/install/files/lib/system/package/PackageArchive.class.php
wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php

index 94de5d85128232487ec2a023ddf83c22aa751742..422ee208e2d10cb98b64aa2166f95976023bd996 100644 (file)
@@ -599,15 +599,15 @@ class PackageArchive
     }
 
     /**
-     * Returns the appropriate update instructions to update the given package,
+     * Returns the appropriate update instructions to update the given package version,
      * `null` if no appropriate instruction could be found.
      *
      * @since 6.0
      */
-    public function getUpdateInstructionsFor(Package $package): ?array
+    public function getUpdateInstructionsFor(string $version): ?array
     {
         foreach ($this->instructions['update'] as $fromVersion => $instructions) {
-            if (Package::checkFromversion($package->packageVersion, $fromVersion)) {
+            if (Package::checkFromversion($version, $fromVersion)) {
                 return $instructions;
             }
         }
index 06855c0d402ae63ab99aac9525685802d047e8a5..88556b49ee65c64a263e8f972b111e2f0aebff31 100644 (file)
@@ -233,7 +233,7 @@ final class PackageValidationArchive implements \RecursiveIterator
             }
         } else {
             // package is already installed, check update path
-            $instructions = $this->archive->getUpdateInstructionsFor($package);
+            $instructions = $this->archive->getUpdateInstructionsFor($package->packageVersion);
             if ($instructions === null) {
                 $deliveredPackageVersion = $this->archive->getPackageInfo('version');