|
|
|
@ -400,7 +400,7 @@ EOF;
|
|
|
|
|
} elseif (file_exists($includeFilesFilePath)) {
|
|
|
|
|
unlink($includeFilesFilePath);
|
|
|
|
|
}
|
|
|
|
|
$filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
|
|
|
|
|
$filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath));
|
|
|
|
|
$checkPlatform = $config->get('platform-check') && !($this->platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter);
|
|
|
|
|
$platformCheckContent = null;
|
|
|
|
|
if ($checkPlatform) {
|
|
|
|
@ -415,7 +415,7 @@ EOF;
|
|
|
|
|
unlink($targetDir.'/platform_check.php');
|
|
|
|
|
}
|
|
|
|
|
$filesystem->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
|
|
|
|
$filesystem->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion, $checkPlatform));
|
|
|
|
|
$filesystem->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform));
|
|
|
|
|
|
|
|
|
|
$filesystem->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
|
|
|
|
$filesystem->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
|
|
|
|
@ -937,11 +937,10 @@ AUTOLOAD;
|
|
|
|
|
* @param string $suffix
|
|
|
|
|
* @param bool $useGlobalIncludePath
|
|
|
|
|
* @param string $prependAutoloader 'true'|'false'
|
|
|
|
|
* @param string $staticPhpVersion
|
|
|
|
|
* @param bool $checkPlatform
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion, $checkPlatform)
|
|
|
|
|
protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform)
|
|
|
|
|
{
|
|
|
|
|
$file = <<<HEADER
|
|
|
|
|
<?php
|
|
|
|
@ -981,7 +980,7 @@ PLATFORM_CHECK;
|
|
|
|
|
|
|
|
|
|
$file .= <<<CLASSLOADER_INIT
|
|
|
|
|
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
|
|
|
|
|
self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(\\dirname(\\dirname(__FILE__)));
|
|
|
|
|
self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(\\dirname(__DIR__));
|
|
|
|
|
spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -998,43 +997,12 @@ INCLUDE_PATH;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$file .= <<<STATIC_INIT
|
|
|
|
|
\$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
|
|
|
|
if (\$useStaticLoader) {
|
|
|
|
|
require __DIR__ . '/autoload_static.php';
|
|
|
|
|
require __DIR__ . '/autoload_static.php';
|
|
|
|
|
\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader)();
|
|
|
|
|
|
|
|
|
|
call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
STATIC_INIT;
|
|
|
|
|
|
|
|
|
|
if (!$this->classMapAuthoritative) {
|
|
|
|
|
$file .= <<<'PSR04'
|
|
|
|
|
$map = require __DIR__ . '/autoload_namespaces.php';
|
|
|
|
|
foreach ($map as $namespace => $path) {
|
|
|
|
|
$loader->set($namespace, $path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$map = require __DIR__ . '/autoload_psr4.php';
|
|
|
|
|
foreach ($map as $namespace => $path) {
|
|
|
|
|
$loader->setPsr4($namespace, $path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PSR04;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($useClassMap) {
|
|
|
|
|
$file .= <<<'CLASSMAP'
|
|
|
|
|
$classMap = require __DIR__ . '/autoload_classmap.php';
|
|
|
|
|
if ($classMap) {
|
|
|
|
|
$loader->addClassMap($classMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CLASSMAP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$file .= " }\n\n";
|
|
|
|
|
|
|
|
|
|
if ($this->classMapAuthoritative) {
|
|
|
|
|
$file .= <<<'CLASSMAPAUTHORITATIVE'
|
|
|
|
|
$loader->setClassMapAuthoritative(true);
|
|
|
|
@ -1073,11 +1041,7 @@ REGISTER_LOADER;
|
|
|
|
|
|
|
|
|
|
if ($useIncludeFiles) {
|
|
|
|
|
$file .= <<<INCLUDE_FILES
|
|
|
|
|
if (\$useStaticLoader) {
|
|
|
|
|
\$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
|
|
|
|
|
} else {
|
|
|
|
|
\$includeFiles = require __DIR__ . '/autoload_files.php';
|
|
|
|
|
}
|
|
|
|
|
\$includeFiles = \Composer\Autoload\ComposerStaticInit$suffix::\$files;
|
|
|
|
|
foreach (\$includeFiles as \$fileIdentifier => \$file) {
|
|
|
|
|
composerRequire$suffix(\$fileIdentifier, \$file);
|
|
|
|
|
}
|
|
|
|
@ -1126,13 +1090,10 @@ FOOTER;
|
|
|
|
|
* @param string $targetDir
|
|
|
|
|
* @param string $vendorPath input for findShortestPathCode
|
|
|
|
|
* @param string $basePath input for findShortestPathCode
|
|
|
|
|
* @param string $staticPhpVersion
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
|
|
|
|
|
protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath)
|
|
|
|
|
{
|
|
|
|
|
$staticPhpVersion = 50600;
|
|
|
|
|
|
|
|
|
|
$file = <<<HEADER
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
@ -1190,11 +1151,6 @@ HEADER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($maps as $prop => $value) {
|
|
|
|
|
if (count($value) > 32767) {
|
|
|
|
|
// Static arrays are limited to 32767 values on PHP 5.6
|
|
|
|
|
// See https://bugs.php.net/68057
|
|
|
|
|
$staticPhpVersion = 70000;
|
|
|
|
|
}
|
|
|
|
|
$value = strtr(
|
|
|
|
|
var_export($value, true),
|
|
|
|
|
array(
|
|
|
|
|