Fix passing of options to remotefilesystem in composer repo
parent
876f143418
commit
33c123e8c2
|
@ -90,7 +90,11 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
$this->io = $io;
|
$this->io = $io;
|
||||||
$this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
|
$this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
|
||||||
$this->loader = new ArrayLoader();
|
$this->loader = new ArrayLoader();
|
||||||
$this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config);
|
if ($rfs) {
|
||||||
|
$rfs = clone $rfs;
|
||||||
|
$rfs->setOptions($this->options);
|
||||||
|
}
|
||||||
|
$this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->repoConfig = $repoConfig;
|
$this->repoConfig = $repoConfig;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +194,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
$url = str_replace('%query%', $query, $this->searchUrl);
|
$url = str_replace('%query%', $query, $this->searchUrl);
|
||||||
|
|
||||||
$hostname = parse_url($url, PHP_URL_HOST) ?: $url;
|
$hostname = parse_url($url, PHP_URL_HOST) ?: $url;
|
||||||
$json = $this->rfs->getContents($hostname, $url, false, $this->options);
|
$json = $this->rfs->getContents($hostname, $url, false);
|
||||||
$results = JsonFile::parseJson($json, $url);
|
$results = JsonFile::parseJson($json, $url);
|
||||||
|
|
||||||
return $results['results'];
|
return $results['results'];
|
||||||
|
@ -607,7 +611,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
}
|
}
|
||||||
|
|
||||||
$hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
|
$hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
|
||||||
$json = $preFileDownloadEvent->getRemoteFilesystem()->getContents($hostname, $filename, false, $this->options);
|
$json = $preFileDownloadEvent->getRemoteFilesystem()->getContents($hostname, $filename, false);
|
||||||
if ($sha256 && $sha256 !== hash('sha256', $json)) {
|
if ($sha256 && $sha256 !== hash('sha256', $json)) {
|
||||||
if ($retries) {
|
if ($retries) {
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
|
|
|
@ -113,6 +113,16 @@ class RemoteFilesystem
|
||||||
return $this->options;
|
return $this->options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges new options
|
||||||
|
*
|
||||||
|
* @return array $options
|
||||||
|
*/
|
||||||
|
public function setOptions(array $options)
|
||||||
|
{
|
||||||
|
$this->options = array_replace_recursive($this->options, $options);
|
||||||
|
}
|
||||||
|
|
||||||
public function isTlsDisabled()
|
public function isTlsDisabled()
|
||||||
{
|
{
|
||||||
return $this->disableTls === true;
|
return $this->disableTls === true;
|
||||||
|
|
Loading…
Reference in New Issue