1
0
Fork 0

quick workaround for Github API limit

pull/1191/merge
Thomas Adam 2012-10-16 14:16:39 +02:00 committed by Jordi Boggiano
parent 3742459a41
commit 1bd5d88b02
2 changed files with 19 additions and 0 deletions

View File

@ -292,6 +292,19 @@ class GitHubDriver extends VcsDriver
$this->io->setAuthorization($this->originUrl, $username, $password);
break;
case 403:
if (!$this->io->hasAuthorization($this->originUrl)) {
if (!$this->io->isInteractive()) {
$this->io->write('<error>API limit exhausted. Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your username and password to increase the API limit</error>');
throw $e;
}
$this->io->write('API limit exhausted. Authentication required for larger API limit (<info>'.$this->url.'</info>):');
$username = $this->io->ask('Username: ');
$password = $this->io->askAndHideAnswer('Password: ');
$this->io->setAuthorization($this->originUrl, $username, $password);
}
break;
default:
throw $e;
break;

View File

@ -207,6 +207,12 @@ class RemoteFilesystem
}
break;
case STREAM_NOTIFY_AUTH_RESULT:
if (403 === $messageCode) {
throw new TransportException($message, 403);
}
break;
case STREAM_NOTIFY_FILE_SIZE_IS:
if ($this->bytesMax < $bytesMax) {
$this->bytesMax = $bytesMax;