Driver: only cache composer.json file without API data to disk

main
Stephan 4 years ago
parent 5fceb4799a
commit b25296ef74

@ -119,11 +119,15 @@ abstract class BitbucketDriver extends VcsDriver
if (!isset($this->infoCache[$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);
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}
if ($composer) {
// specials for bitbucket
if (!isset($composer['support']['source'])) {
@ -173,10 +177,6 @@ abstract class BitbucketDriver extends VcsDriver
}
$this->infoCache[$identifier] = $composer;
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}
return $this->infoCache[$identifier];

@ -150,11 +150,15 @@ class GitHubDriver extends VcsDriver
if (!isset($this->infoCache[$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);
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}
if ($composer) {
// specials for github
if (!isset($composer['support']['source'])) {
@ -172,10 +176,6 @@ class GitHubDriver extends VcsDriver
}
}
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
$this->infoCache[$identifier] = $composer;
}

@ -130,11 +130,15 @@ class GitLabDriver extends VcsDriver
if (!isset($this->infoCache[$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);
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
}
if ($composer) {
// specials for gitlab (this data is only available if authentication is provided)
if (!isset($composer['support']['issues']) && isset($this->project['_links']['issues'])) {
@ -145,10 +149,6 @@ class GitLabDriver extends VcsDriver
}
}
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
$this->infoCache[$identifier] = $composer;
}

Loading…
Cancel
Save