Skip to content
Snippets Groups Projects

Resolve "Remove all use of GLOBALS"

Merged Stein Magne Bjorklund requested to merge 13-remove-all-use-of-globals into master
1 file
+ 10
7
Compare changes
  • Side-by-side
  • Inline
+ 10
7
@@ -19,6 +19,7 @@ final class Endpoint
global $conf;
$accept = 'application/sparql-results+json';
$modified = 0;
$aux = '';
if ($output === 'xml') {
$accept = 'application/sparql-results+xml';
@@ -26,19 +27,21 @@ final class Endpoint
$accept = 'application/rdf+xml';
}
$cacheFile = $conf['home'] . "cache/query" . md5($this->sparqlUrl . $q);
if ($this->caching($conf)) {
$cacheFile = $conf['home'] . "cache/query" . md5($this->sparqlUrl . $q);
if (file_exists($cacheFile)) {
$modified = filemtime($cacheFile);
}
/**
* If we have cached content lets use it.
*/
if ($modified + $conf['cache']['global'] > time()) {
$aux = file_get_contents($cacheFile);
}
}
/**
* If we have cached content use it, if not make a https request.
*/
if ($this->caching($conf) && $modified + $conf['cache']['global'] > time()) {
$aux = (file_get_contents($cacheFile));
} else {
if (!$aux) {
$result = $this->curl($q, $accept, $conf);
$aux = $result['result'];
$this->updateCache($result['status'], $cacheFile, $aux, $conf);
Loading