From 9bee2ca28eea068f108ac4398fe82f12a8af6bc1 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 5 Mar 2018 09:45:48 +0100 Subject: [PATCH] make sure we only cache resources which contain a svn revision like we do in the VCS driver. Closes #7158 --- src/Composer/Repository/Vcs/SvnDriver.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index 1faba8195..b963f6856 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -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); - $this->cache->write($identifier.'.json', json_encode($composer)); + if ($this->shouldCache($identifier)) { + $this->cache->write($identifier.'.json', json_encode($composer)); + } $this->infoCache[$identifier] = $composer; }