Skip to content

Commit

Permalink
Added the url base to the cache key for the headers. If reports have …
Browse files Browse the repository at this point in the history
…two urls (or ports) to access them, it will work correctly and not pull from the cache which may have the wrong urls. Also fixed edge case with a 500 error that happens when you move a report, but it still exists in the recently run.
  • Loading branch information
Auz committed Aug 3, 2015
1 parent bb10fba commit 00ef5b3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/PhpReports/PhpReports.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,18 @@ public static function getReportListJSON($reports=null) {
}

protected static function getReportHeaders($report) {
$cacheKey = FileSystemCache::generateCacheKey($report,'report_headers');
$cacheKey = FileSystemCache::generateCacheKey(array(self::$request->base, $report),'report_headers');

//check if report data is cached and newer than when the report file was created
//the url parameter ?nocache will bypass this and not use cache
$data =false;

$loc = Report::getFileLocation($report);
if(!file_exists($loc)) {
return false;
}
if(!isset($_REQUEST['nocache'])) {
$data = FileSystemCache::retrieve($cacheKey, filemtime(Report::getFileLocation($report)));
$data = FileSystemCache::retrieve($cacheKey, filemtime($loc));
}

//report data not cached, need to parse it
Expand Down

0 comments on commit 00ef5b3

Please sign in to comment.