Fix compatibility with PHP 5.3
parent
6ec9f5ff02
commit
211d4632bb
|
@ -82,7 +82,7 @@ class GitLab
|
|||
|
||||
|
||||
$this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
|
||||
$this->io->writeError('To revoke access to this token you can visit ' . $this->config->get('gitlab-domains')[0] . '/profile/applications');
|
||||
$this->io->writeError('To revoke access to this token you can visit ' . $originUrl . '/profile/applications');
|
||||
|
||||
$attemptCounter = 0;
|
||||
|
||||
|
@ -100,8 +100,8 @@ class GitLab
|
|||
$this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
|
||||
}
|
||||
|
||||
$this->io->writeError('You can also manually create a personal token at ' . $this->config->get('gitlab-domains')[0] . '/profile/applications');
|
||||
$this->io->writeError('Add it using "composer config gitlab-oauth.' . $this->config->get('gitlab-domains')[0] . ' <token>"');
|
||||
$this->io->writeError('You can also manually create a personal token at ' . $originUrl . '/profile/applications');
|
||||
$this->io->writeError('Add it using "composer config gitlab-oauth.' . $originUrl . ' <token>"');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -362,8 +362,8 @@ class RemoteFilesystem
|
|||
) {
|
||||
throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
|
||||
}
|
||||
} else if ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
|
||||
$message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->config->get('gitlab-domains')[0] . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
|
||||
} elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
|
||||
$message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
|
||||
$gitLabUtil = new GitLab($this->io, $this->config, null);
|
||||
if (!$gitLabUtil->authorizeOAuth($this->originUrl)
|
||||
&& (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->originUrl, $message))
|
||||
|
@ -432,7 +432,7 @@ class RemoteFilesystem
|
|||
$auth = $this->io->getAuthentication($originUrl);
|
||||
if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
|
||||
$options['github-token'] = $auth['username'];
|
||||
} elseif ($originUrl === $this->config->get('gitlab-domains')[0]) {
|
||||
} elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
|
||||
if($auth['password'] === 'oauth2') {
|
||||
$headers[] = 'Authorization: Bearer '.$auth['username'];
|
||||
}
|
||||
|
@ -449,9 +449,6 @@ class RemoteFilesystem
|
|||
$options['http']['header'][] = $header;
|
||||
}
|
||||
|
||||
if($this->config && $this->config->get('gitlab-domains') && $originUrl == $this->config->get('gitlab-domains')[0]) {
|
||||
$options['retry-auth-failure'] = false;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue