function FileDownloader::install
@inheritDoc
Overrides DownloaderInterface::install
2 calls to FileDownloader::install()
- FileDownloader::getLocalChanges in vendor/
composer/ composer/ src/ Composer/ Downloader/ FileDownloader.php - @inheritDoc
- FileDownloader::update in vendor/
composer/ composer/ src/ Composer/ Downloader/ FileDownloader.php - @inheritDoc
2 methods override FileDownloader::install()
- ArchiveDownloader::install in vendor/
composer/ composer/ src/ Composer/ Downloader/ ArchiveDownloader.php - @inheritDoc
- PathDownloader::install in vendor/
composer/ composer/ src/ Composer/ Downloader/ PathDownloader.php - @inheritDoc
File
-
vendor/
composer/ composer/ src/ Composer/ Downloader/ FileDownloader.php, line 347
Class
- FileDownloader
- Base downloader for files
Namespace
Composer\DownloaderCode
public function install(PackageInterface $package, string $path, bool $output = true) : PromiseInterface {
if ($output) {
$this->io
->writeError(" - " . InstallOperation::format($package));
}
$vendorDir = $this->config
->get('vendor-dir');
// clean up the target directory, unless it contains the vendor dir, as the vendor dir contains
// the file to be installed. This is the case when installing with create-project in the current directory
// but in that case we ensure the directory is empty already in ProjectInstaller so no need to empty it here.
if (false === strpos($this->filesystem
->normalizePath($vendorDir), $this->filesystem
->normalizePath($path . DIRECTORY_SEPARATOR))) {
$this->filesystem
->emptyDirectory($path);
}
$this->filesystem
->ensureDirectoryExists($path);
$this->filesystem
->rename($this->getFileName($package, $path), $path . '/' . $this->getDistPath($package, PATHINFO_BASENAME));
// Single files can not have a mode set like files in archives
// so we make sure if the file is a binary that it is executable
foreach ($package->getBinaries() as $bin) {
if (file_exists($path . '/' . $bin) && !is_executable($path . '/' . $bin)) {
Silencer::call('chmod', $path . '/' . $bin, 0777 & ~umask());
}
}
return \React\Promise\resolve(null);
}