N°3731 Add DeprecatedCallsLog to autoloader

This commit is contained in:
Pierre Goiffon
2021-04-13 17:41:58 +02:00
parent f8757c6d5d
commit e5559a1899
4 changed files with 37 additions and 1 deletions

View File

@@ -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

View File

@@ -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',

View File

@@ -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';

View File

@@ -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',