Skip to content

Commit

Permalink
Merge pull request #34 from b13/bugfix/file-cache
Browse files Browse the repository at this point in the history
[BUGFIX] baseUrls for file paths
  • Loading branch information
bmack authored Nov 16, 2023
2 parents 5e5036e + ffcaabc commit 96705cf
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Classes/ResourceStorageOperations/CacheService.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,27 @@ protected function flushCaches(array $publicUrls): void
return;
}
$urls = [];
$sites = $this->siteFinder->getAllSites();
foreach ($sites as $site) {
$baseUrls = $this->collectAllPossibleBaseUrls();
foreach ($baseUrls as $baseUrl) {
foreach ($publicUrls as $publicUrl) {
$urls[] = rtrim($site->getBase()->__toString(), '/') . '/' . ltrim($publicUrl, '/');
$urls[] = $baseUrl . '/' . ltrim($publicUrl, '/');
}
}
if (!empty($urls)) {
$this->proxyProvider->flushCacheForUrls($urls);
}
}

protected function collectAllPossibleBaseUrls(): array
{
$baseUrls = [];
$sites = $this->siteFinder->getAllSites();
foreach ($sites as $site) {
$baseUrls[] = $site->getBase()->getScheme() . '://' . $site->getBase()->getHost();
foreach ($site->getLanguages() as $siteLanguage) {
$baseUrls = $siteLanguage->getBase()->getScheme() . '://' . $siteLanguage->getBase()->getHost();
}
}
return array_unique($baseUrls);
}
}

0 comments on commit 96705cf

Please sign in to comment.