mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Added fix to allow nested AutoDatasource instances to manage their own populateCache
This commit is contained in:
parent
4f0da6cd0c
commit
5540dadaaf
@ -68,6 +68,14 @@ class AutoDatasource extends Datasource implements DatasourceInterface
|
||||
$this->postProcessor = new Processor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the in memory path cache map
|
||||
*/
|
||||
public function getPathCache(): array
|
||||
{
|
||||
return $this->pathCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the local cache of paths available in each datasource
|
||||
*
|
||||
@ -78,6 +86,13 @@ class AutoDatasource extends Datasource implements DatasourceInterface
|
||||
{
|
||||
$pathCache = [];
|
||||
foreach ($this->datasources as $datasource) {
|
||||
// Allow AutoDatasource instances to handle their own internal caching
|
||||
if ($datasource instanceof AutoDatasource) {
|
||||
$datasource->populateCache($refresh);
|
||||
$pathCache[] = array_merge(...array_reverse($datasource->getPathCache()));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove any existing cache data
|
||||
if ($refresh && $this->allowCacheRefreshes) {
|
||||
Cache::forget($datasource->getPathsCacheKey());
|
||||
|
Loading…
x
Reference in New Issue
Block a user