|
|
@ -44,18 +44,6 @@ class RemoteFilesystem
|
|
|
|
$this->options = $options;
|
|
|
|
$this->options = $options;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Set the authentication information for the repository.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param string $originUrl The origin URL
|
|
|
|
|
|
|
|
* @param string $username The username
|
|
|
|
|
|
|
|
* @param string $password The password
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function setAuthentication($originUrl, $username, $password = null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return $this->io->setAuthentication($originUrl, $username, $password);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Copy the remote file in local.
|
|
|
|
* Copy the remote file in local.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -137,6 +125,18 @@ class RemoteFilesystem
|
|
|
|
if ($e instanceof TransportException && !empty($http_response_header[0])) {
|
|
|
|
if ($e instanceof TransportException && !empty($http_response_header[0])) {
|
|
|
|
$e->setHeaders($http_response_header);
|
|
|
|
$e->setHeaders($http_response_header);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// in case the remote filesystem responds with an 401 error ask for credentials
|
|
|
|
|
|
|
|
if($e instanceof TransportException && ($e->getCode() == 401))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->io->write('Enter the access credentials needed to access the resource at '.$originUrl);
|
|
|
|
|
|
|
|
$username = $this->io->ask('Username: ');
|
|
|
|
|
|
|
|
$password = $this->io->askAndHideAnswer('Password: ');
|
|
|
|
|
|
|
|
$this->io->setAuthentication($originUrl, $username, $password);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// try getting the file again
|
|
|
|
|
|
|
|
return $this->get($originUrl, $fileUrl, $additionalOptions, $fileName, $progress);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($errorMessage && !ini_get('allow_url_fopen')) {
|
|
|
|
if ($errorMessage && !ini_get('allow_url_fopen')) {
|
|
|
|
$errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
|
|
|
|
$errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
|
|
|
|