1
0
Fork 0

Adjusted config name to be more descriptive, added documentation

pull/7912/head
Kath Young 2019-01-29 07:23:24 +10:30
parent 8b1f8a4629
commit fbb9d20c33
5 changed files with 16 additions and 4 deletions

View File

@ -234,6 +234,14 @@ github API will have a date instead of the machine hostname.
Defaults to `["gitlab.com"]`. A list of domains of GitLab servers.
This is used if you use the `gitlab` repository type.
## use-github-api
Defaults to `true`. Similar to the `no-api` key on a specific repository, setting `use-github-api` to `false` will define the global behavior for all GitHub repositories to clone the
repository as it would with any other git repository instead of using the
GitHub API. But unlike using the `git` driver directly, Composer will still
attempt to use github's zip files.
## notify-on-install
Defaults to `true`. Composer allows repositories to define a notification URL,

View File

@ -271,6 +271,10 @@
"type": "string"
}
},
"use-github-api": {
"type": "boolean",
"description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository."
},
"archive-format": {
"type": "string",
"description": "The default archiving format when not provided on cli, defaults to \"tar\"."

View File

@ -302,7 +302,7 @@ EOT
$uniqueConfigValues = array(
'process-timeout' => array('is_numeric', 'intval'),
'use-include-path' => array($booleanValidator, $booleanNormalizer),
'no-api' => array($booleanValidator, $booleanNormalizer),
'use-github-api' => array($booleanValidator, $booleanNormalizer),
'preferred-install' => array(
function ($val) {
return in_array($val, array('auto', 'source', 'dist'), true);

View File

@ -61,7 +61,7 @@ class Config
'archive-format' => 'tar',
'archive-dir' => '.',
'htaccess-protect' => true,
'no-api' => false,
'use-github-api' => true,
// valid keys without defaults (auth config stuff):
// bitbucket-oauth
// github-oauth
@ -320,7 +320,7 @@ class Config
return $this->config[$key] !== 'false' && (bool) $this->config[$key];
case 'secure-http':
return $this->config[$key] !== 'false' && (bool) $this->config[$key];
case 'no-api':
case 'use-github-api':
return $this->config[$key] !== 'false' && (bool) $this->config[$key];
default:
if (!isset($this->config[$key])) {

View File

@ -56,7 +56,7 @@ class GitHubDriver extends VcsDriver
}
$this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
if ( $this->config->get('no-api') === true || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
$this->setupGitDriver($this->url);
return;