Always check exclusions in PackageUpdateAction::createQueue()
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 14 Apr 2022 10:23:15 +0000 (12:23 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 14 Apr 2022 10:23:15 +0000 (12:23 +0200)
Ever since the method checked for package exclusions in
1d7f1d205ee64fd2723877c1f296c592518e516d it only applied the check to updates,
not to fresh installs. It's not clear why it did so, I assume this to be an
oversight.

Change this to always run the exclusion check, otherwise exclusions might be
circumvented using PackageUpdateAction::prepareInstallation() with a
package+version combination that would regularly be excluded.

wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php

index fb526a90a23ba7833a0ca8d691fcd115d42604f1..e80f1ddad7834d59b68d9573f766efc65a05f886 100644 (file)
@@ -757,19 +757,17 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction
         }
 
         // validate exclusions
-        if ($queueType == 'update') {
-            $excludedPackages = $scheduler->getExcludedPackages();
-
-            if (!empty($excludedPackages)) {
-                return [
-                    'template' => WCF::getTPL()->fetch(
-                        'packageUpdateExcludedPackages',
-                        'wcf',
-                        ['excludedPackages' => $excludedPackages]
-                    ),
-                    'type' => 'conflict',
-                ];
-            }
+        $excludedPackages = $scheduler->getExcludedPackages();
+
+        if (!empty($excludedPackages)) {
+            return [
+                'template' => WCF::getTPL()->fetch(
+                    'packageUpdateExcludedPackages',
+                    'wcf',
+                    ['excludedPackages' => $excludedPackages]
+                ),
+                'type' => 'conflict',
+            ];
         }
 
         $stack = $scheduler->getPackageInstallationStack();