disable prepend option on install
parent
3da05c68f9
commit
65c10daaf8
|
@ -37,7 +37,7 @@ class AutoloadGenerator
|
|||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
|
||||
public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '', $prepend = 'true')
|
||||
{
|
||||
$this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP);
|
||||
|
||||
|
@ -180,7 +180,7 @@ EOF;
|
|||
file_put_contents($targetDir.'/autoload_files.php', $includeFilesFile);
|
||||
}
|
||||
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
||||
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, (bool) $includeFilesFile, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath));
|
||||
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, (bool) $includeFilesFile, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prepend));
|
||||
|
||||
// use stream_copy_to_stream instead of copy
|
||||
// to work around https://bugs.php.net/bug.php?id=64634
|
||||
|
@ -364,7 +364,7 @@ return ComposerAutoloaderInit$suffix::getLoader();
|
|||
AUTOLOAD;
|
||||
}
|
||||
|
||||
protected function getAutoloadRealFile($usePSR0, $useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath)
|
||||
protected function getAutoloadRealFile($usePSR0, $useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prepend)
|
||||
{
|
||||
// TODO the class ComposerAutoloaderInit should be revert to a closure
|
||||
// when APC has been fixed:
|
||||
|
@ -395,7 +395,7 @@ class ComposerAutoloaderInit$suffix
|
|||
return self::\$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prepend);
|
||||
self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
|
||||
|
||||
|
@ -454,7 +454,7 @@ REGISTER_AUTOLOAD;
|
|||
}
|
||||
|
||||
$file .= <<<REGISTER_LOADER
|
||||
\$loader->register(true);
|
||||
\$loader->register($prepend);
|
||||
|
||||
|
||||
REGISTER_LOADER;
|
||||
|
|
|
@ -43,7 +43,8 @@ class InstallCommand extends Command
|
|||
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
|
||||
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
|
||||
new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
|
||||
new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump')
|
||||
new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
|
||||
new InputOption('no-prepend', null, InputOption::VALUE_NONE, 'Disables the prepending of the autoloader')
|
||||
))
|
||||
->setHelp(<<<EOT
|
||||
The <info>install</info> command reads the composer.lock file from
|
||||
|
@ -101,6 +102,7 @@ EOT
|
|||
->setDevMode(!$input->getOption('no-dev'))
|
||||
->setRunScripts(!$input->getOption('no-scripts'))
|
||||
->setOptimizeAutoloader($input->getOption('optimize-autoloader'))
|
||||
->setPrepend(!$input->getOption('no-prepend'))
|
||||
;
|
||||
|
||||
if ($input->getOption('no-plugins')) {
|
||||
|
|
|
@ -106,6 +106,7 @@ class Installer
|
|||
protected $update = false;
|
||||
protected $runScripts = true;
|
||||
protected $updateWhitelist = null;
|
||||
protected $prepend = 'true';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
@ -280,7 +281,7 @@ class Installer
|
|||
|
||||
// write autoloader
|
||||
$this->io->write('<info>Generating autoload files</info>');
|
||||
$this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
|
||||
$this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader, '', $this->prepend);
|
||||
|
||||
if ($this->runScripts) {
|
||||
// dispatch post event
|
||||
|
@ -1055,6 +1056,18 @@ class Installer
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate autoload_real with/without prepend
|
||||
*
|
||||
* @param boolean $prepend
|
||||
* @return Installer
|
||||
*/
|
||||
public function setPrepend($prepend = true)
|
||||
{
|
||||
$this->prepend = (boolean) $prepend === true ? 'true' : 'false';
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables plugins.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue