Fix output of FileDownloader and related to avoid async issues
parent
9809350753
commit
b3951b8804
|
@ -34,9 +34,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
public function install(PackageInterface $package, $path, $output = true)
|
||||
{
|
||||
if ($output) {
|
||||
$this->io->writeError(" - " . InstallOperation::format($package).": Extracting archive");
|
||||
} else {
|
||||
$this->io->writeError('Extracting archive', false);
|
||||
$this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
|
||||
}
|
||||
|
||||
$vendorDir = $this->config->get('vendor-dir');
|
||||
|
@ -151,6 +149,14 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, $path)
|
||||
{
|
||||
return ': Extracting archive';
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract file to directory
|
||||
*
|
||||
|
|
|
@ -355,10 +355,10 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
*/
|
||||
public function update(PackageInterface $initial, PackageInterface $target, $path)
|
||||
{
|
||||
$this->io->writeError(" - " . UpdateOperation::format($initial, $target) . ": ", false);
|
||||
$this->io->writeError(" - " . UpdateOperation::format($initial, $target) . $this->getInstallOperationAppendix($target, $path));
|
||||
|
||||
$promise = $this->remove($initial, $path, false);
|
||||
if ($promise === null || !$promise instanceof PromiseInterface) {
|
||||
if (!$promise instanceof PromiseInterface) {
|
||||
$promise = \React\Promise\resolve();
|
||||
}
|
||||
$self = $this;
|
||||
|
@ -401,6 +401,18 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
return rtrim($this->config->get('vendor-dir').'/composer/tmp-'.md5($package.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets appendix message to add to the "- Upgrading x" string being output on update
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
* @return string
|
||||
*/
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, $path)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the download url
|
||||
*
|
||||
|
|
|
@ -80,9 +80,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
|
||||
if (realpath($path) === $realUrl) {
|
||||
if ($output) {
|
||||
$this->io->writeError(" - " . InstallOperation::format($package).': Source already present');
|
||||
} else {
|
||||
$this->io->writeError('Source already present', false);
|
||||
$this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -216,6 +214,20 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getInstallOperationAppendix(PackageInterface $package, $path)
|
||||
{
|
||||
$realUrl = realpath($package->getDistUrl());
|
||||
|
||||
if (realpath($path) === $realUrl) {
|
||||
return ': Source already present';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if junctions can be created and safely used on Windows
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue