Skip to content

Commit

Permalink
Merge pull request #9693 from totten/master-browser-cache
Browse files Browse the repository at this point in the history
CRM_Extension_Browser - Allow different cache files for different feeds
  • Loading branch information
colemanw authored Jan 18, 2017
2 parents 2f5cb1e + 5bcef2c commit b08ff38
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CRM/Extension/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ private function _discoverRemote() {
* @return string
*/
private function grabCachedJson() {
$filename = $this->cacheDir . DIRECTORY_SEPARATOR . self::CACHE_JSON_FILE;
$json = file_get_contents($filename);
$filename = $this->cacheDir . DIRECTORY_SEPARATOR . self::CACHE_JSON_FILE . '.' . md5($this->getRepositoryUrl());
$json = NULL;
if (file_exists($filename)) {
$json = file_get_contents($filename);
}
if (empty($json)) {
$json = $this->grabRemoteJson();
}
Expand Down Expand Up @@ -246,7 +249,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 b08ff38

Please sign in to comment.