1
0
Fork 0

make sure we only cache resources which contain a svn revision

like we do in the VCS driver.

Closes #7158
pull/7158/merge
Markus Staab 2018-03-05 09:45:48 +01:00 committed by Jordi Boggiano
parent 1336029b72
commit 9bee2ca28e
1 changed files with 12 additions and 2 deletions

View File

@ -115,19 +115,29 @@ class SvnDriver extends VcsDriver
return null;
}
/**
* {@inheritdoc}
*/
protected function shouldCache($identifier)
{
return $this->cache && preg_match('{@\d+$}', $identifier);
}
/**
* {@inheritdoc}
*/
public function getComposerInformation($identifier)
{
if (!isset($this->infoCache[$identifier])) {
if ($res = $this->cache->read($identifier.'.json')) {
if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
return $this->infoCache[$identifier] = JsonFile::parseJson($res);
}
$composer = $this->getBaseComposerInformation($identifier);
if ($this->shouldCache($identifier)) {
$this->cache->write($identifier.'.json', json_encode($composer));
}
$this->infoCache[$identifier] = $composer;
}