1
0
Fork 0

Use JsonFile to decode cached entries

pull/1186/merge
Jordi Boggiano 2012-10-22 17:56:30 +02:00
parent bebd1ce9c7
commit 89d4df990a
1 changed files with 11 additions and 9 deletions

View File

@ -430,16 +430,18 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
break;
} catch (\Exception $e) {
if ($contents = $this->cache->read($cacheKey)) {
if (!$this->degradedMode) {
$this->io->write('<warning>'.$e->getMessage().'</warning>');
$this->io->write('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
}
$this->degradedMode = true;
$data = json_decode($contents, true);
if (!$retries) {
if ($contents = $this->cache->read($cacheKey)) {
if (!$this->degradedMode) {
$this->io->write('<warning>'.$e->getMessage().'</warning>');
$this->io->write('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
}
$this->degradedMode = true;
$data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
break;
}
break;
} elseif (!$retries) {
throw $e;
}