aboutsummaryrefslogtreecommitdiffstats
path: root/apps/cloud_federation_api
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-01-28 14:24:34 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-01-28 14:24:34 +0100
commit299f37c5d99982032c2c607467cb344759212d68 (patch)
treeda959356a560d288aa305ba0f3b088e56851715b /apps/cloud_federation_api
parent7e7284d790f55a14ec100771c08809e32514c533 (diff)
downloadnextcloud-server-299f37c5d99982032c2c607467cb344759212d68.tar.gz
nextcloud-server-299f37c5d99982032c2c607467cb344759212d68.zip
Update all composer autoloader files
The format changed between 2.0.8 and 2.0.9. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/cloud_federation_api')
-rw-r--r--apps/cloud_federation_api/composer/composer/ClassLoader.php32
-rw-r--r--apps/cloud_federation_api/composer/composer/autoload_real.php2
2 files changed, 33 insertions, 1 deletions
diff --git a/apps/cloud_federation_api/composer/composer/ClassLoader.php b/apps/cloud_federation_api/composer/composer/ClassLoader.php
index 1a58957d25d..4d989a212c9 100644
--- a/apps/cloud_federation_api/composer/composer/ClassLoader.php
+++ b/apps/cloud_federation_api/composer/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,15 @@ class ClassLoader
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+
+ if (null === $this->vendorDir) {
+ //no-op
+ } elseif ($prepend) {
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
+ } else {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ self::$registeredLoaders[$this->vendorDir] = $this;
+ }
}
/**
@@ -308,6 +326,10 @@ class ClassLoader
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
+
+ if (null !== $this->vendorDir) {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ }
}
/**
@@ -367,6 +389,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/apps/cloud_federation_api/composer/composer/autoload_real.php b/apps/cloud_federation_api/composer/composer/autoload_real.php
index 81afd5039a7..f0ee7acb591 100644
--- a/apps/cloud_federation_api/composer/composer/autoload_real.php
+++ b/apps/cloud_federation_api/composer/composer/autoload_real.php
@@ -23,7 +23,7 @@ class ComposerAutoloaderInitCloudFederationAPI
}
spl_autoload_register(array('ComposerAutoloaderInitCloudFederationAPI', 'loadClassLoader'), true, true);
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitCloudFederationAPI', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());