Renamed, document and tested static_config_path / static_object_directory
This commit is contained in:
1 parent
55419acb09
commit
c4f5504fdf
4 files changed
+94
-6
No files matched your search
@@ -53,7 +53,7 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
|
||||
'cache_storage' => null,
|
||||
'cache_prefix' => 'clobj:',
|
||||
'cache_ttl' => 60,
|
||||
'static_config_path' => null,
|
||||
'static_object_directory' => null,
|
||||
'auth_ns' => null,
|
||||
'auth_secret' => null,
|
||||
'api_base_url' => null,
|
||||
@@ -66,6 +66,10 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
|
||||
'permanent_store_scope' => null
|
||||
], $options);
|
||||
|
||||
// Support deprecated name of static_object_directory
|
||||
if (!isset($this->options['static_object_directory']) && isset($options['static_config_path']))
|
||||
$this->options['static_object_directory'] = $options['static_config_path'];
|
||||
|
||||
// Check object cache configuration
|
||||
if (isset($this->options['cache_storage'])
|
||||
&& !($this->options['cache_storage'] instanceof CacheStorageInterface)
|
||||
@@ -377,14 +381,14 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
|
||||
return $this->objects[$uriString][1];
|
||||
}
|
||||
|
||||
if (isset($this->options['static_config_path'])) {
|
||||
$location = realpath($this->options['static_config_path'].DIRECTORY_SEPARATOR.
|
||||
if (isset($this->options['static_object_directory'])) {
|
||||
$location = realpath($this->options['static_object_directory'].DIRECTORY_SEPARATOR.
|
||||
$coid->getHost().str_replace('/', DIRECTORY_SEPARATOR, $coid->getPath())
|
||||
.DIRECTORY_SEPARATOR.'object.jsonld');
|
||||
|
||||
if ($location && file_exists($location)) {
|
||||
$object = $location;
|
||||
$this->logInfoWithTime('Fetched <'.$uriString.'> from static configuration.', $ts);
|
||||
$this->logInfoWithTime('Fetched <'.$uriString.'> from static object directory.', $ts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user