From e5559a1899ccd28a1bf042c5983ea514e65f9c8e Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 13 Apr 2021 17:41:58 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03731=20Add=20DeprecatedCallsLog=20to=20a?= =?UTF-8?q?utoloader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/composer/ClassLoader.php | 34 ++++++++++++++++++++++++++++++ lib/composer/autoload_classmap.php | 1 + lib/composer/autoload_real.php | 2 +- lib/composer/autoload_static.php | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/lib/composer/ClassLoader.php b/lib/composer/ClassLoader.php index 1a58957d2..247294d66 100644 --- a/lib/composer/ClassLoader.php +++ b/lib/composer/ClassLoader.php @@ -42,6 +42,8 @@ namespace Composer\Autoload; */ class ClassLoader { + private $vendorDir; + // PSR-4 private $prefixLengthsPsr4 = array(); private $prefixDirsPsr4 = array(); @@ -57,6 +59,13 @@ class ClassLoader private $missingClasses = array(); private $apcuPrefix; + private static $registeredLoaders = array(); + + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + public function getPrefixes() { if (!empty($this->prefixesPsr0)) { @@ -300,6 +309,17 @@ class ClassLoader public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } } /** @@ -308,6 +328,10 @@ class ClassLoader public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } } /** @@ -367,6 +391,16 @@ class ClassLoader return $file; } + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + private function findFileWithExtension($class, $ext) { // PSR-4 lookup diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php index 47d6e3ee2..ee1be2f96 100644 --- a/lib/composer/autoload_classmap.php +++ b/lib/composer/autoload_classmap.php @@ -403,6 +403,7 @@ return array( 'DefaultWorkingTimeComputer' => $baseDir . '/core/computing.inc.php', 'DeleteException' => $baseDir . '/application/exceptions/DeleteException.php', 'DeletionPlan' => $baseDir . '/core/deletionplan.class.inc.php', + 'DeprecatedCallsLog' => $baseDir . '/core/log.class.inc.php', 'DesignerBooleanField' => $baseDir . '/application/forms.class.inc.php', 'DesignerComboField' => $baseDir . '/application/forms.class.inc.php', 'DesignerForm' => $baseDir . '/application/forms.class.inc.php', diff --git a/lib/composer/autoload_real.php b/lib/composer/autoload_real.php index 4f1c7e5ca..661cd2543 100644 --- a/lib/composer/autoload_real.php +++ b/lib/composer/autoload_real.php @@ -25,7 +25,7 @@ class ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b require __DIR__ . '/platform_check.php'; spl_autoload_register(array('ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); spl_autoload_unregister(array('ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; diff --git a/lib/composer/autoload_static.php b/lib/composer/autoload_static.php index b2203eac1..df1cd996b 100644 --- a/lib/composer/autoload_static.php +++ b/lib/composer/autoload_static.php @@ -633,6 +633,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'DefaultWorkingTimeComputer' => __DIR__ . '/../..' . '/core/computing.inc.php', 'DeleteException' => __DIR__ . '/../..' . '/application/exceptions/DeleteException.php', 'DeletionPlan' => __DIR__ . '/../..' . '/core/deletionplan.class.inc.php', + 'DeprecatedCallsLog' => __DIR__ . '/../..' . '/core/log.class.inc.php', 'DesignerBooleanField' => __DIR__ . '/../..' . '/application/forms.class.inc.php', 'DesignerComboField' => __DIR__ . '/../..' . '/application/forms.class.inc.php', 'DesignerForm' => __DIR__ . '/../..' . '/application/forms.class.inc.php',