|
@@ -116,53 +116,23 @@ class SvnDriver extends VcsDriver
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * {@inheritDoc}
|
|
|
|
|
|
+ * {@inheritdoc}
|
|
*/
|
|
*/
|
|
public function getComposerInformation($identifier)
|
|
public function getComposerInformation($identifier)
|
|
{
|
|
{
|
|
- $identifier = '/' . trim($identifier, '/') . '/';
|
|
|
|
-
|
|
|
|
- if ($res = $this->cache->read($identifier.'.json')) {
|
|
|
|
- $this->infoCache[$identifier] = JsonFile::parseJson($res);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (!isset($this->infoCache[$identifier])) {
|
|
if (!isset($this->infoCache[$identifier])) {
|
|
- preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
|
|
|
|
- if (!empty($match[2])) {
|
|
|
|
- $path = $match[1];
|
|
|
|
- $rev = $match[2];
|
|
|
|
- } else {
|
|
|
|
- $path = $identifier;
|
|
|
|
- $rev = '';
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- $resource = $path.'composer.json';
|
|
|
|
- $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
|
|
|
|
- if (!trim($output)) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- } catch (\RuntimeException $e) {
|
|
|
|
- throw new TransportException($e->getMessage());
|
|
|
|
|
|
+ if ($res = $this->cache->read($identifier.'.json')) {
|
|
|
|
+ return $this->infoCache[$identifier] = JsonFile::parseJson($res);
|
|
}
|
|
}
|
|
|
|
|
|
- $composer = JsonFile::parseJson($output, $this->baseUrl . $resource . $rev);
|
|
|
|
-
|
|
|
|
- if (empty($composer['time'])) {
|
|
|
|
- $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
|
|
|
|
- foreach ($this->process->splitLines($output) as $line) {
|
|
|
|
- if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
|
|
|
|
- $date = new \DateTime($match[1], new \DateTimeZone('UTC'));
|
|
|
|
- $composer['time'] = $date->format('Y-m-d H:i:s');
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ $composer = $this->getBaseComposerInformation($identifier);
|
|
|
|
|
|
$this->cache->write($identifier.'.json', json_encode($composer));
|
|
$this->cache->write($identifier.'.json', json_encode($composer));
|
|
|
|
+
|
|
$this->infoCache[$identifier] = $composer;
|
|
$this->infoCache[$identifier] = $composer;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
return $this->infoCache[$identifier];
|
|
return $this->infoCache[$identifier];
|
|
}
|
|
}
|
|
|
|
|
|
@@ -174,10 +144,6 @@ class SvnDriver extends VcsDriver
|
|
{
|
|
{
|
|
$identifier = '/' . trim($identifier, '/') . '/';
|
|
$identifier = '/' . trim($identifier, '/') . '/';
|
|
|
|
|
|
- if ($res = $this->cache->read($identifier . ':' . $file)) {
|
|
|
|
- return $res;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
|
|
preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
|
|
if (!empty($match[2])) {
|
|
if (!empty($match[2])) {
|
|
$path = $match[1];
|
|
$path = $match[1];
|
|
@@ -197,8 +163,6 @@ class SvnDriver extends VcsDriver
|
|
throw new TransportException($e->getMessage());
|
|
throw new TransportException($e->getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
- $this->cache->write($identifier . ':' . $file, $output);
|
|
|
|
-
|
|
|
|
return $output;
|
|
return $output;
|
|
}
|
|
}
|
|
|
|
|