public function fetchAllFromOperations(IO\IOInterface $io, Config $config, array $ops)
{
$cachedir = rtrim($config->get('cache-files-dir'), '\\/');
$requests = array();
foreach ($ops as $op) {
switch ($op->getJobType()) {
case 'install':
$p = $op->getPackage();
break;
case 'update':
$p = $op->getTargetPackage();
break;
default:
continue 2;
}
$url = $this->getUrlFromPackage($p);
if (!$url) {
continue;
}
$destination = $cachedir . DIRECTORY_SEPARATOR . FileDownloaderDummy::getCacheKeyCompat($p, $url);
if (file_exists($destination)) {
continue;
}
$useRedirector = (bool) preg_match('%^(?:https|git)://github\\.com%', $p->getSourceUrl());
try {
$request = new CopyRequest($url, $destination, $useRedirector, $io, $config);
$requests[] = $request;
} catch (FetchException $e) {
// do nothing
}
}
if (count($requests) > 0) {
$this->fetchAll($io, $requests);
}
}