From 7530beb931fd581f100459360233fa76be8751d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 16 Nov 2022 12:14:56 +0100 Subject: [PATCH] Remove PackageArchive::isValidUpdate() The method relies on the stateful `PackageArchive::$package` property and `PackageArchive::filterUpdateInstructions()` which is super intransparent. The last remaining user was removed in the previous commit. see #5094 --- .../system/package/PackageArchive.class.php | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php index 4f7847cfd1..94de5d8512 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -468,38 +468,6 @@ class PackageArchive @\unlink($this->archive); } - /** - * Checks if the new package is compatible with - * the package that is about to be updated. - */ - public function isValidUpdate(?Package $package = null): bool - { - if ($this->package === null && $package !== null) { - $this->package = $package; - - // re-evaluate update data - $this->filterUpdateInstructions(); - } - - // Check name of the installed package against the name of the update. Both must be identical. - if ($this->packageInfo['name'] != $this->package->package) { - return false; - } - - // Check if the version number of the installed package is lower than the version number to which - // it's about to be updated. - if (Package::compareVersion($this->packageInfo['version'], $this->package->packageVersion) != 1) { - return false; - } - - // Check if the package provides an instructions block for the update from the installed package version - if (empty($this->instructions['update'])) { - return false; - } - - return true; - } - /** * Checks if the current package is already installed, as it is not * possible to install non-applications multiple times within the -- 2.20.1