public function onPreFileDownload(CPlugin\PreFileDownloadEvent $ev) { $url = $ev->getProcessedUrl(); if (preg_match('/^https?/', $url)) { $rfs = $ev->getRemoteFilesystem(); $ev->setRemoteFilesystem(new CurlRemoteFilesystem($this->io, $this->config, $rfs->getOptions())); } }
public function onPreFileDownload(CPlugin\PreFileDownloadEvent $ev) { $scheme = parse_url($ev->getProcessedUrl(), PHP_URL_SCHEME); if ($scheme === 'http' || $scheme === 'https') { $rfs = $ev->getRemoteFilesystem(); $ev->setRemoteFilesystem(new CurlRemoteFilesystem($this->io, $this->config, $rfs->getOptions())); } }
public function onPreFileDownload(PreFileDownloadEvent $event) { $protocol = parse_url($event->getProcessedUrl(), PHP_URL_SCHEME); if ($protocol === 's3') { $awsClient = new AwsClient($this->io, $this->composer->getConfig()); $s3RemoteFilesystem = new S3RemoteFilesystem($this->io, $this->composer->getConfig(), $event->getRemoteFilesystem()->getOptions(), $awsClient); $event->setRemoteFilesystem($s3RemoteFilesystem); } }
/** * Keep-Alived file downloader */ public function onPreFileDownload(CPlugin\PreFileDownloadEvent $ev) { if ($this->disabled) { return; } $rfs = $ev->getRemoteFilesystem(); $curlrfs = new CurlRemoteFilesystem($this->io, $this->config, $rfs->getOptions()); $ev->setRemoteFilesystem($curlrfs); }
public function onPreFileDownload(PreFileDownloadEvent $event) { $url = $event->getProcessedUrl(); $host = parse_url($url, PHP_URL_HOST); $protocol = parse_url($url, PHP_URL_SCHEME); if (in_array($host, $this->hosts, true) && ($protocol === 'http' || $protocol === 'https')) { $orig = $event->getRemoteFilesystem(); $curl = new CurlRemoteFilesystem($this->curlClient, $this->io, $this->composer->getConfig(), $orig->getOptions()); $event->setRemoteFilesystem($curl); } }
public function onPreFileDownload(PreFileDownloadEvent $event) { $downloadReplacements = $this->composer->getConfig()->get('download-replacements'); $searched = false; foreach ($downloadReplacements as $search => $replacement) { if (strpos($event->getProcessedUrl(), $search) === 0) { $searched = true; break; } } if ($searched) { $qiniu = new FileSystem($this->io, $this->composer->getConfig(), $event->getRemoteFilesystem() ? $event->getRemoteFilesystem()->getOptions() : array()); $qiniu->setConfig($this->composer->getConfig()); $event->setRemoteFilesystem($qiniu); } }
/** * Add the key from the environment to the event url * * The key is not added to the package because it would show up in the * composer.lock file in this case. A custom file system is used to * swap out the WPM PRO url with a url that contains the key. * * @access public * @param PreFileDownloadEvent $event The event that called this method * @throws MissingKeyException */ public function addKey(PreFileDownloadEvent $event) { $processedUrl = $event->getProcessedUrl(); if ($this->isWPMProPackageUrl($processedUrl)) { $processedUrl = $processedUrl . 'site_url=' . $this->getSiteUrlFromEnv(); $rfs = $event->getRemoteFilesystem(); $wpmRfs = new RemoteFilesystem($this->addParameterToUrl($processedUrl, 'licence_key', $this->getKeyFromEnv()), $this->io, $this->composer->getConfig(), $rfs->getOptions(), $rfs->isTlsDisabled()); $event->setRemoteFilesystem($wpmRfs); } }
/** * Add the key from the environment to the event url * * The key is not added to the package because it would show up in the * composer.lock file in this case. A custom file system is used to * swap out the ACF PRO url with a url that contains the key. * * @access public * @param PreFileDownloadEvent $event The event that called this method * @throws MissingKeyException */ public function addKey(PreFileDownloadEvent $event) { $processedUrl = $event->getProcessedUrl(); if ($this->isAcfProPackageUrl($processedUrl)) { $rfs = $event->getRemoteFilesystem(); $acfRfs = new RemoteFilesystem($this->addParameterToUrl($processedUrl, 'k', $this->getKeyFromEnv()), $this->io, $this->composer->getConfig(), $rfs->getOptions(), $rfs->isTlsDisabled()); $event->setRemoteFilesystem($acfRfs); } }
/** * Set the remote filesystem for scp files. */ public function setRfs(PreFileDownloadEvent $event) { static $rfs; // is this an ssh url? if (strpos($event->getProcessedUrl(), 'ssh://') === 0) { if (!$rfs) { $rfs = new SSHFilesystem($this->io); } $event->setRemoteFilesystem($rfs); } }