Merge pull request #9077 from glaubinix/f/api-data-detection

Driver: only cache composer.json file without API data to disk
main
Jordi Boggiano 4 years ago committed by GitHub
commit 7028d0ce27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -119,10 +119,14 @@ abstract class BitbucketDriver extends VcsDriver
if (!isset($this->infoCache[$identifier])) { if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) { if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
return $this->infoCache[$identifier] = JsonFile::parseJson($res); $composer = JsonFile::parseJson($res);
} } else {
$composer = $this->getBaseComposerInformation($identifier);
$composer = $this->getBaseComposerInformation($identifier); if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}
if ($composer) { if ($composer) {
// specials for bitbucket // specials for bitbucket
@ -173,10 +177,6 @@ abstract class BitbucketDriver extends VcsDriver
} }
$this->infoCache[$identifier] = $composer; $this->infoCache[$identifier] = $composer;
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
} }
return $this->infoCache[$identifier]; return $this->infoCache[$identifier];

@ -150,10 +150,14 @@ class GitHubDriver extends VcsDriver
if (!isset($this->infoCache[$identifier])) { if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) { if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
return $this->infoCache[$identifier] = JsonFile::parseJson($res); $composer = JsonFile::parseJson($res);
} } else {
$composer = $this->getBaseComposerInformation($identifier);
$composer = $this->getBaseComposerInformation($identifier); if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}
if ($composer) { if ($composer) {
// specials for github // specials for github
@ -172,10 +176,6 @@ class GitHubDriver extends VcsDriver
} }
} }
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
$this->infoCache[$identifier] = $composer; $this->infoCache[$identifier] = $composer;
} }

@ -130,10 +130,14 @@ class GitLabDriver extends VcsDriver
if (!isset($this->infoCache[$identifier])) { if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) { if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
return $this->infoCache[$identifier] = JsonFile::parseJson($res); $composer = JsonFile::parseJson($res);
} } else {
$composer = $this->getBaseComposerInformation($identifier);
$composer = $this->getBaseComposerInformation($identifier); if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}
if ($composer) { if ($composer) {
// specials for gitlab (this data is only available if authentication is provided) // specials for gitlab (this data is only available if authentication is provided)
@ -145,10 +149,6 @@ class GitLabDriver extends VcsDriver
} }
} }
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
$this->infoCache[$identifier] = $composer; $this->infoCache[$identifier] = $composer;
} }
@ -446,7 +446,7 @@ class GitLabDriver extends VcsDriver
if (!$moreThanGuestAccess) { if (!$moreThanGuestAccess) {
$this->io->writeError('<warning>GitLab token with Guest only access detected</warning>'); $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
return $this->attemptCloneFallback(); return $this->attemptCloneFallback();
} }
} }

Loading…
Cancel
Save