gzwrite($fileHandler,
$content);
} /**
* Makes sure all files get closed and replaces the old sitemaps with the freshly generated ones
*/
private function moveFiles() { /** @var Sitemap[] $sitemaps */
foreach ($this->sitemaps
as $shopId =>
$sitemaps) { // Delete old sitemaps for this siteId
foreach ($this->filesystem->
listContents(sprintf('shop-%d',
$shopId)) as $file) { $this->filesystem->
delete($file['path'
]);
} // Move new sitemaps into place
foreach ($sitemaps as $sitemap) { $sitemapFileName =
$this->sitemapNameGenerator->
getSitemapFilename($shopId);
try { $this->filesystem->
write($sitemapFileName,
file_get_contents($sitemap->
getFilename()));
} catch (\League\Flysystem\Exception
$exception) { $this->logger->
error(sprintf('Could not move sitemap to "%s" in the location for sitemaps',
$sitemapFileName));
} finally {