Skip to content

Commit

Permalink
CRM_Extension_Browser - Allow different cache files for different feeds
Browse files Browse the repository at this point in the history
The motivation here is to support these two different CLI commands:

```
cv dl myextension
cv dl myextension --dev
```

The two commands differ in that they pull from different feeds -- e.g.  the
stable feed `https://civicrm.org/extdir/ver={ver}|cms={uf}` vs the
developmental feed `https://civicrm.org/extdir/ver={ver}|cms={uf}|status=`.
However, this creates the real possibility that the user might go back/forth
among different feeds (omitting/enabling the `--dev` option per whim).
  • Loading branch information
totten committed Jan 17, 2017
1 parent 45e0b0b commit 9a853a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CRM/Extension/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private function _discoverRemote() {
* @return string
*/
private function grabCachedJson() {
$filename = $this->cacheDir . DIRECTORY_SEPARATOR . self::CACHE_JSON_FILE;
$filename = $this->cacheDir . DIRECTORY_SEPARATOR . self::CACHE_JSON_FILE . '.' . md5($this->getRepositoryUrl());
$json = file_get_contents($filename);
if (empty($json)) {
$json = $this->grabRemoteJson();
Expand Down Expand Up @@ -246,7 +246,7 @@ private function grabRemoteJson() {
return array();
}

$filename = $this->cacheDir . DIRECTORY_SEPARATOR . self::CACHE_JSON_FILE;
$filename = $this->cacheDir . DIRECTORY_SEPARATOR . self::CACHE_JSON_FILE . '.' . md5($this->getRepositoryUrl());
$url = $this->getRepositoryUrl() . $this->indexPath;
$status = CRM_Utils_HttpClient::singleton()->fetch($url, $filename);

Expand Down

0 comments on commit 9a853a8

Please sign in to comment.