File: 0011-Only-include-installed-versions-class-when-plugins-a.patch

package info (click to toggle)
composer 2.5.5-1%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,484 kB
  • sloc: php: 71,775; makefile: 70; xml: 39
file content (25 lines) | stat: -rw-r--r-- 1,357 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From: Jordi Boggiano <j.boggiano@seld.be>
Date: Fri, 26 Jan 2024 17:11:16 +0100
Subject: Only include installed versions class when plugins and scripts are
 allowed, as it is not needed otherwise

Origin: upstream, https://github.com/composer/composer/commit/952256247c6441d5a444d15c1607228a6d97316f
---
 src/Composer/Factory.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php
index f82a9c3..b198f0f 100644
--- a/src/Composer/Factory.php
+++ b/src/Composer/Factory.php
@@ -350,8 +350,8 @@ class Factory
             // load auth configs into the IO instance
             $io->loadConfiguration($config);
 
-            // load existing Composer\InstalledVersions instance if available
-            if (!class_exists('Composer\InstalledVersions', false) && file_exists($installedVersionsPath = $config->get('vendor-dir').'/composer/InstalledVersions.php')) {
+            // load existing Composer\InstalledVersions instance if available and scripts/plugins are allowed, as they might need it
+            if (!$disablePlugins && !$disableScripts && !class_exists('Composer\InstalledVersions', false) && file_exists($installedVersionsPath = $config->get('vendor-dir').'/composer/InstalledVersions.php')) {
                 include $installedVersionsPath;
             }
         }